we have a utility we want to run on startup. in terminal we run it with “sudo ./xxxxx” where xxxx is the application.
We have tried Gnome Utility Tweaker but that doesn’t give us the ability to start a bash script.
How do we do this? Thanks!!!
Hi and Welcome to the Forum
You can create a simple systemd service file pointing at your script in
/etc/systemd/system called say script001.service containing;
# /etc/systemd/system/script001.service
#
[Unit]
Description=Run my boot script
[Service]
Type=oneshot
ExecStart=/bin/sh -c "/path/to/script/scriptname"
[Install]
WantedBy=multi-user.target
Once that’s saved, you can run, check and enable;
systemctl start script001.service
systemctl status script001.service
{if all ok}
systemctl enable script001.service
Alternatively, if it’s a “system thing”, you can use cron to to the job:
- Drop a cronjob file owned by the user who is to execute the command at boot time in ‘/etc/crond.d/’.
- Make sure that only the user has the write permission for the file.
- Content is something like this:
#
# No e-Mail
MAILTO=""
#
@reboot «User name» «Command or script to be executed … »
#
The Man page is: (5) crontab.