Atuin daemon as Systemd user service

I use Atuin for friendly shell history and to sync it across my computers. It’s great, it just doesn’t play well with ZFS. As a workaround, Atuin recently added a daemon mode so there’s one writer to handle sqlite instead of each shell command invocation hitting the same sqlite database.

Currently there are no docs on how to set this up because daemon mode is experimental, so here’s how I did it.

Create a systemd user unit in ~/.config/systemd/user/atuin.service:

[Unit]
Description=Atuin daemon
[Service]
Type=simple
ExecStart=%h/.cargo/bin/atuin daemon
Restart=always
[Install]
WantedBy=default.target

Start it: systemctl --user enable atuin.service --now

And you should now see it running:

jda@tangent:~$ systemctl --user status atuin
● atuin.service - Atuin daemon
     Loaded: loaded (/home/jda/.config/systemd/user/atuin.service; enabled; preset: enabled)
     Active: active (running) since Thu 2024-10-10 23:32:27 MDT; 3min 48s ago
   Main PID: 585068 (atuin)
      Tasks: 4 (limit: 618587)
     Memory: 4.6M
        CPU: 90ms
     CGroup: /user.slice/user-1000.slice/user@1000.service/app.slice/atuin.service
             └─585068 /home/jda/.cargo/bin/atuin daemon

Oct 10 23:32:27 tangent systemd[4756]: Started atuin.service - Atuin daemon.

Now you need to tell Atuin to use the daemon by adding the following to ~/.config/atuin/config.toml:

[daemon]
enabled = true
Want to keep reading? / go back