Computing.Net > Forums > Linux > Startup script doesn't run

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Startup script doesn't run

Reply to Message Icon

Name: Selina
Date: September 30, 2002 at 09:32:55 Pacific
OS: Linux
CPU/Ram: 64MB
Comment:

Hi,
Can anyone help?
I have created a Startup script to start a queue manager when the machine is rebooted, the code seems fine:

#!/bin/sh
su - mqm -c "strmqm {QM_name}"
su - mqm -c "strmqcsv {QM_name}"

I have saved this under /etc/rc6.d. And enetered 'chmod 777 {filename}'. Problem is when I reboot the machine, the scripts doesn't run (start up my queue managers).

Have I put the file in the wrong location?

thanks,
Selina



Sponsored Link
Ads by Google

Response Number 1
Name: armin
Date: September 30, 2002 at 10:30:12 Pacific
Reply:

usually scripts reside in /etc/init.d or the like. the directories with the numbers 1-6 represent the 6 runlevels. put the script in /etc/init.d (or where your distro has its scripts) and symlink it to /etc/rcX.d where the X stands for your default runlevel. (3 or 5 in rh and suse, 2 in debian)

btw chmod 777 is extremely dangerous for a startup script since EVERYONE could hide a startup cmd for a trojan in that script that would then run with root rights !!!

apart from that you can skip the su command at the beginning since these scripts are run by init which runs with root privileges anyway.


0

Response Number 2
Name: Richard
Date: September 30, 2002 at 10:36:41 Pacific
Reply:

Putting it in /etc/rc6.d will have the effect of running it when you have told the machine to reboot, not after the machine has booted.

Instead, you ought to put it in /etc/rc2.d.

In fact, the precise location depends a bit on distro. Debian uses /etc/rc[0-6].d, whereas Redhat (and I presume Mandrake) use /etc/rc.d/rc[0-6].d

That was the easy answer. The correct way to do it, is to put it in /etc/init.d (or /etc/rc.d/init.d) and then create symbolic links called SNNservice (where NN refers to a number giving the order in which you want it to run, relative to the other files in the directory, and service is the name of the file in /etc/init.d) in each of the rd?.d directories related to the runlevel where you want it to run.


0

Response Number 3
Name: Shadowlight
Date: September 30, 2002 at 16:20:21 Pacific
Reply:

Armin,

I wouldn't recomend to run mqm queue managers
as root mqm does't like it, so Selina is right to use su.

next Selina sould indeed check to which runlevel her system goes and make a link there to /etc/init.d where her script should live.


0

Response Number 4
Name: Selina
Date: October 7, 2002 at 06:58:13 Pacific
Reply:

Thank you for the replying!!!


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: Startup script doesn't run

OpenOffice doesn't run on Mandrake9 www.computing.net/answers/linux/openoffice-doesnt-run-on-mandrake9/15934.html

kernel 2.4 doesn't run on Duron?? www.computing.net/answers/linux/kernel-24-doesnt-run-on-duron/12507.html

why cronjob doesn't work www.computing.net/answers/linux/why-cronjob-doesnt-work/6429.html