You are not logged in.
Has anyone done this successfully? I have successfully configured systemd (208) user instance for my account using the wiki instructions to set up tmux, a daemon for my preferred terminal emulator mlterm, and some other stuff. Now, I run indexing for general files (recoll), email-specific (mu), and offlineimap for email sync. To test it out, I started with the latter to run it hourly. I basically took the information from the Systemd Cron Functionality page but added the targets with the other targets and wants in the user directory ~/.config/systemd/user. Is this correct?
Here is a directory listing explaining what I have in the path mentioned above.
$ ls -la ~/.config/systemd/user/
total 96
drwxr-xr-x 10 me users 4096 Feb 17 14:57 .
drwxr-xr-x 3 me users 4096 Dec 11 01:37 ..
-rw-r--r-- 1 me users 453 Feb 11 14:36 aria2.service
drwxr-xr-x 2 me users 4096 Feb 3 09:45 basic.target.wants
drwxr-xr-x 2 me users 4096 Feb 3 09:44 daily.target.wants
lrwxrwxrwx 1 me users 48 Feb 17 14:57 default.target -> /home/me/.config/systemd/user/multiplexer.target
drwxr-xr-x 2 me users 4096 Jan 29 11:58 default.target.wants
-rw-r--r-- 1 me users 294 Jan 23 16:42 emacs.service
drwxr-xr-x 2 me users 4096 Feb 3 09:44 hourly.target.wants
-rw-r--r-- 1 me users 141 Dec 11 14:24 mlterm.service
-rw-r--r-- 1 me users 134 Feb 4 16:45 mu.service
-rw-r--r-- 1 me users 123 Dec 11 10:31 multiplexer.target
drwxr-xr-x 2 me users 4096 Dec 11 14:31 multiplexer.target.wants
-rw-r--r-- 1 me users 257 Feb 4 16:40 offlineimap.service
-rw-r--r-- 1 me users 135 Feb 4 16:47 recoll.service
-rw-r--r-- 1 me users 58 Feb 3 09:43 timer-daily.target
drwxr-xr-x 2 me users 4096 Feb 4 16:47 timer-daily.target.wants
-rw-r--r-- 1 me users 131 Feb 3 09:42 timer-daily.timer
-rw-r--r-- 1 me users 59 Feb 3 09:43 timer-hourly.target
drwxr-xr-x 2 me users 4096 Feb 17 14:57 timer-hourly.target.wants
-rw-r--r-- 1 me users 132 Feb 3 09:42 timer-hourly.timer
-rw-r--r-- 1 me users 59 Feb 3 09:43 timer-weekly.target
-rw-r--r-- 1 me users 134 Feb 3 09:42 timer-weekly.timer
-rw-r--r-- 1 me users 227 Feb 9 16:17 tmux.service
drwxr-xr-x 2 me users 4096 Feb 3 09:44 weekly.target.wants
Here is the first attempt, my offlineimap service.
[Unit]
Description=OfflineIMAP Email Sync
[Service]
Type=simple
EnvironmentFile=%h/.cache/gpg-agent-info
ExecStart=/home/me/.venv/offlineimap/bin/python offlineimap.py
WorkingDirectory=/home/me/.local/src/offlineimap
[Install]
WantedBy=timer-hourly.target
And it seems to enable ok (I have enabled and disabled serveral times.
$ systemctl --user disable offlineimap
rm '/home/me/.config/systemd/user/timer-hourly.target.wants/offlineimap.service'
$ systemctl --user enable offlineimap
ln -s '/home/me/.config/systemd/user/offlineimap.service' '/home/me/.config/systemd/user/timer-hourly.target.wants/offlineimap.service'
But the logs do not show anything happening when it hits the hourly timer. Many hours show up like that below, with no of the services running once it hits the timer.
Feb 17 15:02:16 laptop systemd[1]: Stopped target Hourly Timer Target.
Feb 17 15:02:16 laptop systemd[1]: Stopping Hourly Timer Target.
Feb 17 15:02:16 laptop systemd[1]: Service timer-hourly.target is not needed anymore. Stopping.
Feb 17 15:02:16 laptop systemd[1]: Reached target Hourly Timer Target.
Feb 17 15:02:16 laptop systemd[1]: Starting Hourly Timer Target.
Any thoughts? Not sure how to debug the timer failures. Has anyone implemented this successfully or knows how to troubleshoot?
Last edited by ajstein (2014-03-11 11:24:09)
Offline
I believe you have to issue a few commands for your timers to be recognized.
You can run: systemctl status (unit file) to find out if the file is even loaded, and then if it is not, that is your problem.
I've found that after creating a new timer service file and dumping it into one of the timer.wants directories, I have to issue: systemctl daemon-reload which looks for changed or new units.
Offline
Not sure why but the recent update to systemd210 when updating with pacman a few days ago resolved the issue for me. The timers started firing up again. Not sure why. But I will mark it solved for now.
Offline