LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   start script bash when system start,stop,reeboot, how ?? (https://www.linuxquestions.org/questions/linux-general-1/start-script-bash-when-system-start-stop-reeboot-how-774713/)

melmar 12-10-2009 06:28 AM

start script bash when system start,stop,reeboot, how ??
 
Hi, I have 3 script BASH.

I want start this script when the system start,stop and reeboot.

Can I do it??

How??

Thanks a lot!

evo2 12-10-2009 06:40 AM

Make a script called foo that takes the arguments start, stop and restart. Put it in the directory /etc/init.d/

Here I'm assuming that your default runlevel is 2 (Debian and I guess Ubuntu default), so make a link:
Code:

ln -s /etc/init.d/foo /etc/rc2.d/S99foo
At boot time this script will be called with the "start" argument, at shutdown with the "stop" argument. Have a look at the other scripts in /etc/init.d/ and google for inspiration.

Cheers,

Evo2.

zhjim 12-10-2009 06:41 AM

This link might be worth reading.
http://tldp.org/HOWTO/From-PowerUp-T...t-HOWTO-6.html

catkin 12-10-2009 06:53 AM

The boot script system varies from distro to distro. In a system using /etc/init.d/ and /etc/rc[0-6S].d/ directories it is the K* symlinks that are run with the "stop" argument during shutdown. Which distro are you using?

melmar 12-10-2009 06:58 AM

Quote:

Originally Posted by catkin (Post 3786595)
Which distro are you using?

I use Ubuntu 9.10


All times are GMT -5. The time now is 08:02 AM.