2

I am trying to write a service with timers. But it is not being executed:

example@host /etc/systemd/system/mbsync.service:

[Unit]
Description=Mailbox synchronisation service for user example

[Service]
Type=oneshot
ExecStart=/usr/bin/mbsync -aV
User=example
StandardOutput=syslog
StandardError=syslog

example@host /etc/systemd/system/mbsync.timer:

[Unit]
Description=Mailbox synchronisation timer

[Timer]
OnBootSec=10s
OnCalendar=*:00/2

[Install]
WantedBy=default.target

I started the service like this:

systemctl daemon-reload
systemctl enable mbsync.timer
systemctl start mbsync.timer

But I only get:

systemctl list-timers

NEXT LEFT LAST                         PASSED       UNIT         ACTIVATES
Mon 2015-11-30 11:50:00 CET  10s ago       Mon 2015-11-30 11:50:07 CET  2s ago  mbsync.timer                 mbsync.service
0

Your timer is executed, but it may not do what you expect. You should check logs with systemctl status -l mbsync.service and tune your .mbsyncrc accordingly.

I found these resources helpful:

especially the second one, with user unit files, which is required when using PassCmd "gpg ...".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.