Skip to content

Trouble setting up a mbsync.timer file w/ systemd --user.

I'm trying to set up a mbsync.timer file using 'systemd --user' and I keep getting an error. I'd really appreciate it if someone could give me some pointers or help me spot the problem. After adding the files at the bottom of this post, I ran the folowing:

systemctl --user daemon-reload
systemctl --user start mbsync

and got the following:

Failed to start mbsync.service: Unit mbsync.service failed to load: No such file or directory.

when I run

systemctl --user status

it says:

State: degraded
Jobs: 0 queued
Failed: 1 units

~/.config/systemd/user/mbsync@.service:

[Unit]
Description=Sync with IMAP server(s): %i

[Service]
Type=simple
ExecStart=/usr/bin/mbsync -q %i

~/.config/systemd/user/mbsync@.timer:

[Unit]
Description=Sync mailboxes with %i

[Timer]
OnCalendar=*-*-* *:*:00

Edited 9 Jan 2015. We only hold this version.

2 points9 comments
Open on Reddit
About this post
Posted
Archived
Edited
Score
2 · 100% up
Kind
Text
ID
2rt4ke

Author

4
posts
10
comments
0
media
View profile

9 comments

  1. timers must be enabled

  2. mbsync needs to be run with something after that @ symbol! You have to say systemctl --user start mbsync@something for it to pass in something for that %i

So I would imagine you'd do something like:

systemctl --user enable mbsync@myimapserver.timer

2 points

Thank you, this got it working! Now I just need to set up a gpg-agent service file for unlocking my subkey to unlock the encrypted account password, and I should be good to go. This may end up making a good wiki entry...

1 points

Try saving your timer unit in /etc/systemd/user and enable it with $systemctl enable <timer unit name>

This will symlink it into ~/.config/.........

1 points

I would suggest ignoring this suggestion, the $XDG* dirs were something that lennart directly worked on, systemd supports them extremely well.

2 points

Certainly understand your thinking here, but here are my thoughts on that:

  1. Placing the unit in /etc/systemd/user allows you to enable/disable the service/timer as need be whereas placing it in ~/.config/systemd/user it will always be enabled.

  2. With the unit in ~/.config/systemd/user should you accidentally systemctl disable the unit/timer, I gather the file will be deleted from ~/.config/systemd/user (essentially what disabling does) resulting in your file being permanently lost.

Cheers.

1 points

Wouldn't systemctl --user enable mbsync.service in the same directory as the service file do the same thing without root permissions for /etcd/systemd/user ?

1 points

This is off the top of my head. I'll confirm when I get home. I have a timer unit setup for checking inboxes

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.