I have setup few user systemd.timer(s).
How to make them start automatically ? (either on system start or once user logged into X session).
After I restart of the system (even systemctl --user enable
was run before restart, i.e. does not help) I have none running:
~$ systemctl --user enable {rsync_backup1,rsync_another_backup}.timer
~$ systemctl --user list-timers --all
0 timers listed.
Here I commands I need to use to start them after :
~$ systemctl --user start {rsync_backup1,rsync_another_backup}.timer
~$ systemctl --user list-timers --all
NEXT LEFT LAST PASSED UNIT
Sun 2016-07-31 13:26:45 CEST 1h 16min ago Sun 2016-07-31 14:43:32 CEST 2s ago rsync_backup1
Sun 2016-07-31 13:26:45 CEST 1h 16min ago Sun 2016-07-31 14:43:32 CEST 2s ago rsync_another_backup
2 timers listed.
~$
Here is example how timers are currently configured :
$HOME/.config/systemd/user/rsync_backup1.service :
[Unit]
Description=rsync --delete /home/USER data to NASUSER@NAS
[Service]
Type=simple
ExecStart=/home/USER/scripts/rsync_backup1.sh
$HOME/.config/systemd/user/rsync_backup1.timer :
[Unit]
Description=Runs every 12 minutes rsync --delete /home/USER data to NASUSER@NAS
[Timer]
OnBootSec=12min
AccuracySec=10min
OnCalendar=*:0/12
Unit=rsync_backup1.service
[Install]
WantedBy=multi-user.target
P.S. Yes, I know I can drop commands, which start my timers into .bashrc
or .xinit
or my Window Manager "startup" scripts. What I am asking is: is there "systemd" "clean" way to define this to run after every restart (/login) ?
multi-user.target
. See my answer – meuh Jul 31 '16 at 14:44systemd-analyze critical-chain
? (I am using Arch Linux -> maybe it's distro specific?) – Grzegorz Wierzowiecki Jul 31 '16 at 15:49systemctl --user
. Of course, for "root" systemd, there is a multi-user.target. – meuh Jul 31 '16 at 15:56default.target
, in the .timer units. Also do you run anenable
command or onlystart
? – Roman Kiselenko Jul 31 '16 at 17:16enable
and it does not help. – Grzegorz Wierzowiecki Jul 31 '16 at 21:55