Difference between revisions of "Run command or script on linux startup"
From DevOps Notebook
(Created page with "There are few ways. 1. With /etc/rc.local") |
|||
| Line 1: | Line 1: | ||
There are few ways. | There are few ways. | ||
| − | 1. With /etc/rc.local | + | 1. With '''/etc/rc.local''' (edit file and add script you wanna run, before that chmod +x myscript.sh) |
| + | <br> <br> | ||
| + | 2. Using crontab (run crontab -e) | ||
| + | <pre> | ||
| + | @reboot /path/to/script | ||
| + | </pre> | ||
| + | |||
| + | 3. Using [[Create_a_custom_systemd_service|systemd]] | ||
Latest revision as of 18:14, 7 June 2020
There are few ways.
1. With /etc/rc.local (edit file and add script you wanna run, before that chmod +x myscript.sh)
2. Using crontab (run crontab -e)
@reboot /path/to/script
3. Using systemd