Fixing a systemd service 203/EXEC failure (no such file or directory)

前端 未结 6 2061
时光取名叫无心
时光取名叫无心 2020-12-07 21:46

I\'m trying to set up a simple systemd timer to run a bash script every day at midnight.

systemctl --user status backup.service fails and logs the follo

6条回答
  •  误落风尘
    2020-12-07 22:24

    I think I found the answer:

    In the .service file, I needed to add /bin/bash before the path to the script.

    For example, for backup.service:

    ExecStart=/bin/bash /home/user/.scripts/backup.sh

    As opposed to:

    ExecStart=/home/user/.scripts/backup.sh

    I'm not sure why. Perhaps fish. On the other hand, I have another script running for my email, and the service file seems to run fine without /bin/bash. It does use default.target instead multi-user.target, though.

    Most of the tutorials I came across don't prepend /bin/bash, but I then saw this SO answer which had it, and figured it was worth a try.

    The service file executes the script, and the timer is listed in systemctl --user list-timers, so hopefully this will work.

    Update: I can confirm that everything is working now.

提交回复
热议问题