How to run a script at boot? Tested on Fedora, CentOS and Raspbian.
You can use cron via @reboot
directive.
@reboot /path/to/script
But, as far as I can see, if you need the network, it seems that this way is not suitable. Then, instead, you can use oneshot type in a systemd service.
Let’s create a systemd service file:
vi /etc/systemd/system/bootbotto.service
Then create the script.
vi /usr/local/bin/bootbotto
Set it as executable.
chmod 700 /usr/local/bin/bootbotto
Then enable the service and execute it immediately (with –now).
systemctl daemon-reload; systemctl enable bootbotto --now
This script will be executed at boot, once the networking service will be started. As you can see, this script will send a message on a Telegram group.