Best Answer: How Do I Run a Linux Script After Boot?

Best Answer: How Do I Run a Linux Script After Boot?
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:

  1. Run your test script without cron to make sure it actually works.
  2. Make sure you saved your command in cron, use sudo crontab -e.
  3. 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:

  1. create a script file like disable_cdrom in convenient for you location. In my case home/yterle/disable_cdrom . …
  2. make it executable chmod 775 disable_cdrom.
  3. navigate to /etc/systemd/system and create there a service file. For example sudo gedit /etc/systemd/system/disable_cdrom.service.
James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.