Skip to main content
2 of 4
Fixed a few misspellings, simplified wording, formatted file names as code; removed the OS tag (it doesn't seem to be an Arch-specific issue)
fra-san
  • 10.8k
  • 2
  • 27
  • 45

Systemd service running bash script fails

On Arch Linux, I am trying to create a systemd service which runs this Bash script:

#!/bin/bash

/bin/xbindkeys &
/bin/setxkbmap -layout gb

With some online guidance I then made a file named myfirst.service in /etc/systemd/system to store my service. Here are the contents of the file:

[Unit]
Description=Command Service

[Service]
ExecStart=/etc/startupjobscript
User=user1
Type=oneshot
Restart=on-abort
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

The service is supposed to execute /etc/startupjobscript, which is the Bash script. After this I enabled and started the service with:

systemctl enable myfirst
systemctl start myfirst

But for some reason it doesn't work and shows that it has failed to load and run at all.

programmer
  • 1.1k
  • 7
  • 17
  • 35