Improve systemd services: automatic restart

This commit is contained in:
Thomas Dehaeze 2019-05-02 10:44:57 +02:00
parent c3408232b8
commit 0b1247d8bc

View File

@ -29,6 +29,7 @@
Description=Sync All Mails every x hours Description=Sync All Mails every x hours
RefuseManualStart=no RefuseManualStart=no
RefuseManualStop=no RefuseManualStop=no
Wants=network-online.target
After=network.target network-online.target dbus.socket After=network.target network-online.target dbus.socket
[Timer] [Timer]
@ -88,6 +89,7 @@
Description=Check Mail every x minutes Description=Check Mail every x minutes
RefuseManualStart=no RefuseManualStart=no
RefuseManualStop=no RefuseManualStop=no
Wants=network-online.target
After=network.target network-online.target dbus.socket After=network.target network-online.target dbus.socket
Requires=checkmail.service Requires=checkmail.service
@ -188,6 +190,7 @@
Description=Sync All Mails every x hours Description=Sync All Mails every x hours
RefuseManualStart=no RefuseManualStart=no
RefuseManualStop=no RefuseManualStop=no
Wants=network-online.target
After=network.target network-online.target dbus.socket After=network.target network-online.target dbus.socket
Requires=syncmail.service Requires=syncmail.service
@ -235,6 +238,8 @@
[Unit] [Unit]
Description=Synchronize calendars and contacts Description=Synchronize calendars and contacts
Documentation=https://vdirsyncer.readthedocs.org/ Documentation=https://vdirsyncer.readthedocs.org/
Wants=network-online.target
After=network.target network-online.target
[Service] [Service]
ExecStart=/usr/bin/vdirsyncer sync ExecStart=/usr/bin/vdirsyncer sync
@ -246,7 +251,6 @@
:header-args: :tangle ~/.config/systemd/user/vdirsyncer.timer :header-args: :tangle ~/.config/systemd/user/vdirsyncer.timer
:header-args+: :comments both :mkdirp yes :header-args+: :comments both :mkdirp yes
:END: :END:
#+begin_src conf #+begin_src conf
[Unit] [Unit]
Description=Synchronize vdirs Description=Synchronize vdirs
@ -268,13 +272,53 @@
#+begin_src conf #+begin_src conf
[Unit] [Unit]
Description=A WeeChat client and relay service using Tmux Description=A WeeChat client and relay service using Tmux
After=network.target Wants=network-online.target
After=network.target network-online.target
[Service] [Service]
Type=forking Type=forking
ExecStart=/usr/bin/tmux -L weechat new -d -s weechat weechat ExecStart=/usr/bin/tmux -L weechat new -d -s weechat weechat
ExecStop=/usr/bin/tmux -L weechat kill-session -t weechat ExecStop=/usr/bin/tmux -L weechat kill-session -t weechat
Restart=always
RestartSec=3
[Install] [Install]
WantedBy=default.target WantedBy=default.target
#+end_src #+end_src
* Neomutt
** Service
:PROPERTIES:
:header-args: :tangle ~/.config/systemd/user/neomutt.service
:header-args+: :comments both :mkdirp yes
:END:
#+begin_src conf
[Unit]
Description=Neomutt - mail client
[Service]
Type=forking
ExecStart=/usr/bin/tmux -L neomutt new -d -s neomutt neomutt
ExecStop=/usr/bin/tmux -L neomutt kill-session -t neomutt
Restart=always
RestartSec=3
[Install]
WantedBy=default.target
#+end_src
* Powertop
** Service
:PROPERTIES:
:header-args: :tangle ~/.config/systemd/user/powertop.service
:header-args+: :comments both :mkdirp yes
:END:
#+begin_src conf
[Unit]
Description=Powertop tunings
[Service]
ExecStart=/usr/bin/powertop --auto-tune
RemainAfterExit=true
[Install]
WantedBy=multi-user.target
#+end_src