Hi,
How do I make sure that a script is run when a server is started of restarted ?
/home/me/scripts/this.sh
Linux startup script
Re: Linux startup script
There are several ways to run a script on startup/reboot on linux.
My favorite : Crontab
Another way to do it,
local.d scripts at boot time, add its init.d script to the default runlevel.
and then create you own script in /etc/local.d/:
You can also create you own service,
But that is a bit more complicated.
My favorite : Crontab
Code: Select all
sudo crontab -e
@reboot /home/me/scripts/this.sh
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
Code: Select all
nano /etc/local.d/myService.start
But that is a bit more complicated.