The shell scripts are as follows:
/home/tron/systemd/raspi-store
- Code: Select all
#!/bin/sh
date -R > /home/tron/systemd/time.stamp
/home/tron/systemd/raspi-restore
- Code: Select all
#!/bin/sh
date -s "`cat /home/tron/systemd/time.stamp`"
Both scripts work just fine (chmodded to 0755), when I execute them as root or using sudo. The services are as follows:
/home/tron/systemd/raspi-store.service
- Code: Select all
[Unit]
Description=Store RasPi time
DefaultDependencies=no
Before=shutdown.target
[Service]
Type=oneshot
ExecStart=/home/tron/systemd/raspi-store
StandardOutput=syslog
/home/tron/systemd/raspi-restore.service
- Code: Select all
[Unit]
Description=Restore RasPi time
DefaultDependencies=no
After=sysinit.target
Before=shutdown.target
Conflicts=shutdown.target
[Service]
Type=oneshot
ExecStart=/home/tron/systemd/raspi-restore
StandardOutput=syslog
In /usr/lib/systemd/system/ I created two symlinks to the services in my /home/tron/systemd folder. When I issued systemctl daemon-reload, and then did systemctl start raspi-store and systemctl raspi-restore, the services both executed just fine.
The problem occurs when I try to execute systemctl enable raspi-store or systemctl enable raspi-restore so that I can have the services load on boot. I forget the exact error that's issued, but it's something about a failed method called. The idea here is to use two systemd services, one on startup and one on shutdown, to restore and store the last good time, respectively. The services were modeled using alsa-store.service and alsa-restore.service as a reference. Any ideas why this is failing?