What is the best (KISS) way to make the OS executes my bash script on every boot
Creating a systemd-timer with OnBootSec option or systemd.service seem to me kind of overhead.
For example, I have added the line session optional pam_exec.so type=open_session seteuid /root/telegram_alert.sh into the /etc/pam.d/sshd and it does the job when somebody login to the server via ssh.
So is there any way to invoke my script on system boot? It is not hard to me create the systemd.service for this. But looking for a simplest way.
About this post
- Posted
- Archived
- Score
- 6 · 88% up
- Kind
- Text
- ID
- o7s5bm
4 comments
The simplest way is to create a systemd service.
Running things on boot is literally what services were made for. Just create the systemd service and have done with it.
The only arguably complex thing about a systemd service is systemd itself. If you're using systemd already (which you are, given that you're using Arch), then the simplest option is to use a service.
The systemd service is actually the simplest way to do it
Overhead? Assuming you mean in writing it (because if it's running anyway then there's no added overhead there) a service could be just 5 lines. Each about 1/5th of the length of the length of the one-liner you posted for something else. (And much shorter than your question here.)