Linux startup script

All questions related to servers
Post Reply
Posts: 168
Joined: Thu Mar 04, 2010 9:19 pm

Linux startup script

Post by mister_v »


How do I make sure that a script is run when a server is started of restarted ?

Site Admin
Posts: 170
Joined: Mon Jul 21, 2008 9:52 am

Re: Linux startup script

Post by chris »

There are several ways to run a script on startup/reboot on linux.

My favorite : Crontab

Code: Select all

sudo crontab -e
@reboot /home/me/scripts/

Another way to do it,
local.d scripts at boot time, add its init.d script to the default runlevel.

Code: Select all

Enable local.d Scripts
rc-service local start
and then create you own script in /etc/local.d/:

Code: Select all

nano /etc/local.d/myService.start
You can also create you own service,
But that is a bit more complicated.
Post Reply