- Useful for personal automation on maybe useful for automation on Linux based EC2 instances
- Rename fields in .sh file according to your usage
If you have some arbitrary bash(.sh) file in home/user/somefile/run.sh Then follow these steps to make sure this bash script is always run on startup.
- cd into etc/systemd/system/
- sudo nano name.service
- Reload the systemd daemon to recognize the new service: sudo systemctl daemon-reload
- Start Service: sudo systemctl start name
- Enable the service to start automatically on system boot: sudo systemctl enable name
- Check: sudo systemctl status name