Contents
How do I run a Linux script from startup?
This is the way I do it on Red Hat Linux systems. Put your script in /etc/init. d , owned by root and executable.
…
Test Test Test:
- Run your test script without cron to make sure it actually works.
- Make sure you saved your command in cron, use sudo crontab -e.
- Reboot the server to confirm it all works sudo @reboot.
How do I run a script as root on startup?
This worked for me on Ubuntu 17.04:
- create a script file like disable_cdrom in convenient for you location. In my case home/yterle/disable_cdrom . …
- make it executable chmod 775 disable_cdrom.
- navigate to /etc/systemd/system and create there a service file. For example sudo gedit /etc/systemd/system/disable_cdrom.service.