Running script at startup


Step 1: Create your startup script in /usr/local/bin/startup.sh you could have something simple in it to verify it runs like:

#!/bin/bash
echo "Startup script succeeded!"

Step 2: Create a file in /etc/systemd/system/startup.service and put the following code in it:

[Unit]
Description=Startup Service
After=network.target

[Service]
Type=simple
ExecStart=/usr/local/bin/startup.sh

[Install]
WantedBy=multi-user.target

Step 3: Test your startup script with:

systemctl daemon-reload
systemctl enable startup
systemctl start startup

Step 4: Check your status with:

systemctl status startup

Borrowed from Ian Walker at Rocky Linux here