From d13a2fd835b6273fb6d654a6bacc65d360f0ce19 Mon Sep 17 00:00:00 2001 From: tdro Date: Mon, 17 Jan 2022 19:45:01 -0500 Subject: .config/systemd: Cleanup user services Fail loudly on failure for some units. --- .config/systemd/user/autocutsel.service | 7 +++++-- .config/systemd/user/copyq.service | 6 ++++-- .config/systemd/user/events-idle.service | 12 +++++++----- .config/systemd/user/events-resume.service | 6 ++++-- .config/systemd/user/events-usb.service | 6 ++++-- .config/systemd/user/flameshot.service | 6 ++++-- .config/systemd/user/plank.service | 6 +++--- .config/systemd/user/redshift.service | 7 +++++-- .config/systemd/user/syncthing.service | 18 ++++++------------ .config/systemd/user/unclutter.service | 6 ++++-- .config/systemd/user/x0vncserver.service | 12 ------------ .config/systemd/user/x11vnc.service | 5 +++-- .config/systemd/user/xbindkeys.service | 4 +++- 13 files changed, 52 insertions(+), 49 deletions(-) delete mode 100644 .config/systemd/user/x0vncserver.service diff --git a/.config/systemd/user/autocutsel.service b/.config/systemd/user/autocutsel.service index 82e822b..5d93368 100644 --- a/.config/systemd/user/autocutsel.service +++ b/.config/systemd/user/autocutsel.service @@ -1,13 +1,16 @@ [Unit] Description=Keep the X clipboard and the cutbuffer in sync +StartLimitBurst=5 +StartLimitIntervalSec=600 + [Service] Type=forking -RestartSec=3s +RestartSec=3 Restart=always SyslogIdentifier=autocutsel -ExecStartPre=/usr/bin/env autocutsel -f -s PRIMARY ExecStart=/usr/bin/env autocutsel -f -s CLIPBOARD +ExecStartPre=/usr/bin/env autocutsel -f -s PRIMARY [Install] WantedBy=default.target diff --git a/.config/systemd/user/copyq.service b/.config/systemd/user/copyq.service index cd09ee0..cb1a057 100644 --- a/.config/systemd/user/copyq.service +++ b/.config/systemd/user/copyq.service @@ -1,12 +1,14 @@ [Unit] Description=Copyq server +StartLimitBurst=5 +StartLimitIntervalSec=600 [Service] Type=simple -ExecStart=/usr/bin/env copyq +RestartSec=3 Restart=always -RestartSec=5s SyslogIdentifier=copyq +ExecStart=/usr/bin/env copyq [Install] WantedBy=default.target diff --git a/.config/systemd/user/events-idle.service b/.config/systemd/user/events-idle.service index 7c5cdec..095b1d8 100644 --- a/.config/systemd/user/events-idle.service +++ b/.config/systemd/user/events-idle.service @@ -1,15 +1,17 @@ [Unit] Description=Execute events on X11 idle +StartLimitBurst=5 +StartLimitIntervalSec=600 [Service] Type=simple -ExecStartPre=/usr/bin/env sh -c '%h/.local/bin/scripts/events-idle' -ExecStart=/usr/bin/env sh -c 'while true; do sleep 300 && [ "$(xprintidle)" -gt 120000 ] && %h/.local/bin/scripts/events-idle; done' +IOWeight=60 +CPUQuota=60% +RestartSec=5 Restart=always -RestartSec=5s SyslogIdentifier=events-idle -CPUQuota=60% -IOWeight=60 +ExecStartPre=/usr/bin/env sh -c '%h/.local/bin/scripts/events-idle' +ExecStart=/usr/bin/env sh -c 'while true; do sleep 300 && [ "$(xprintidle)" -gt 120000 ] && %h/.local/bin/scripts/events-idle; done' [Install] WantedBy=default.target diff --git a/.config/systemd/user/events-resume.service b/.config/systemd/user/events-resume.service index b8bce6a..98724d0 100644 --- a/.config/systemd/user/events-resume.service +++ b/.config/systemd/user/events-resume.service @@ -1,12 +1,14 @@ [Unit] Description=Execute events on resume event +StartLimitBurst=5 +StartLimitIntervalSec=600 [Service] Type=simple -ExecStart=/usr/bin/env sh -c 'dbus-monitor --system | while read; do grep -q 'PrepareForSleep' && %h/.local/bin/scripts/events-resume; done' +RestartSec=3 Restart=always -RestartSec=5s SyslogIdentifier=events-resume +ExecStart=/usr/bin/env sh -c 'dbus-monitor --system | while read; do grep -q 'PrepareForSleep' && %h/.local/bin/scripts/events-resume; done' [Install] WantedBy=default.target diff --git a/.config/systemd/user/events-usb.service b/.config/systemd/user/events-usb.service index d2a5b63..030a0c3 100644 --- a/.config/systemd/user/events-usb.service +++ b/.config/systemd/user/events-usb.service @@ -1,12 +1,14 @@ [Unit] Description=Execute events on kernel usb events +StartLimitBurst=5 +StartLimitIntervalSec=600 [Service] Type=simple -ExecStart=/usr/bin/env sh -c 'udevadm monitor | while read; do grep -m1 -q "(usb)" && %h/.local/bin/scripts/events-usb; done' +RestartSec=3 Restart=always -RestartSec=5s SyslogIdentifier=events-usb +ExecStart=/usr/bin/env sh -c 'udevadm monitor | while read; do grep -m1 -q "(usb)" && %h/.local/bin/scripts/events-usb; done' [Install] WantedBy=default.target diff --git a/.config/systemd/user/flameshot.service b/.config/systemd/user/flameshot.service index 431fc04..caf212e 100644 --- a/.config/systemd/user/flameshot.service +++ b/.config/systemd/user/flameshot.service @@ -1,12 +1,14 @@ [Unit] Description=Screenshot tool +StartLimitBurst=5 +StartLimitIntervalSec=600 [Service] Type=simple -ExecStart=/usr/bin/env flameshot +RestartSec=3 Restart=always -RestartSec=5s SyslogIdentifier=flameshot +ExecStart=/usr/bin/env flameshot [Install] WantedBy=default.target diff --git a/.config/systemd/user/plank.service b/.config/systemd/user/plank.service index 4f92af7..760e71b 100644 --- a/.config/systemd/user/plank.service +++ b/.config/systemd/user/plank.service @@ -4,12 +4,12 @@ StartLimitIntervalSec=0 [Service] Type=simple -Environment=XDG_SESSION_TYPE=X11 -ExecStart=/usr/bin/env plank +RestartSec=1 Restart=always -RestartSec=1s KillMode=process SyslogIdentifier=plank +ExecStart=/usr/bin/env plank +Environment=XDG_SESSION_TYPE=X11 [Install] WantedBy=default.target diff --git a/.config/systemd/user/redshift.service b/.config/systemd/user/redshift.service index e18f1e4..c1ef6a3 100644 --- a/.config/systemd/user/redshift.service +++ b/.config/systemd/user/redshift.service @@ -1,12 +1,15 @@ [Unit] Description=Redshift +StartLimitBurst=5 +StartLimitIntervalSec=600 + [Service] Type=simple -ExecStart=/usr/bin/env redshift +RestartSec=3 Restart=always -RestartSec=5s SyslogIdentifier=redshift +ExecStart=/usr/bin/env redshift [Install] WantedBy=default.target diff --git a/.config/systemd/user/syncthing.service b/.config/systemd/user/syncthing.service index d1b862c..7683fad 100644 --- a/.config/systemd/user/syncthing.service +++ b/.config/systemd/user/syncthing.service @@ -1,21 +1,15 @@ [Unit] Description=Syncthing - Open Source Continuous File Synchronization -After=network.target +StartLimitBurst=5 +StartLimitIntervalSec=600 [Service] -ExecStart=/usr/bin/env syncthing -no-browser -no-restart -logflags=0 +IOWeight=60 +CPUQuota=60% +RestartSec=3 Restart=always -RestartSec=5s SyslogIdentifier=syncthing -CPUQuota=60% -IOWeight=60 - -# Hardening -ProtectSystem=full -PrivateTmp=true -SystemCallArchitectures=native -MemoryDenyWriteExecute=true -NoNewPrivileges=true +ExecStart=/usr/bin/env syncthing -no-browser -no-restart -logflags=0 [Install] WantedBy=default.target diff --git a/.config/systemd/user/unclutter.service b/.config/systemd/user/unclutter.service index ac4941c..03313f0 100644 --- a/.config/systemd/user/unclutter.service +++ b/.config/systemd/user/unclutter.service @@ -1,12 +1,14 @@ [Unit] Description=Hide mouse on idle +StartLimitBurst=5 +StartLimitIntervalSec=600 [Service] Type=simple -ExecStart=/usr/bin/env unclutter -idle 1 +RestartSec=3 Restart=always -RestartSec=5s SyslogIdentifier=unclutter +ExecStart=/usr/bin/env unclutter -idle 1 [Install] WantedBy=default.target diff --git a/.config/systemd/user/x0vncserver.service b/.config/systemd/user/x0vncserver.service deleted file mode 100644 index e3e1abe..0000000 --- a/.config/systemd/user/x0vncserver.service +++ /dev/null @@ -1,12 +0,0 @@ -[Unit] -Description=Remote desktop service (VNC) - -[Service] -Type=forking -ExecStart=/usr/bin/env /usr/bin/sh -c '/usr/bin/x0vncserver -rfbport 5900 -RemapKeys="0x3c->0x2c" -passwordfile %h/.vnc/passwd &' -Restart=always -RestartSec=5s -SyslogIdentifier=x0vncserver - -[Install] -WantedBy=default.target diff --git a/.config/systemd/user/x11vnc.service b/.config/systemd/user/x11vnc.service index 98e6fe7..1e0ce0c 100644 --- a/.config/systemd/user/x11vnc.service +++ b/.config/systemd/user/x11vnc.service @@ -1,10 +1,11 @@ [Unit] Description=Remote desktop service (VNC) -StartLimitIntervalSec=0 +StartLimitBurst=5 +StartLimitIntervalSec=600 [Service] Type=simple -RestartSec=1s +RestartSec=3 Restart=always SyslogIdentifier=x11vnc ExecStart=/usr/bin/env x11vnc -display $DISPLAY -rfbport 5900 -shared -usepw -forever -nowireframe -norepeat -noxdamage -noxrecord -ncache_cr -noxfixes -auth $XAUTHORITY diff --git a/.config/systemd/user/xbindkeys.service b/.config/systemd/user/xbindkeys.service index 82eaf76..8ec94a4 100644 --- a/.config/systemd/user/xbindkeys.service +++ b/.config/systemd/user/xbindkeys.service @@ -1,9 +1,11 @@ [Unit] Description=Keyboard shortcut binder +StartLimitBurst=5 +StartLimitIntervalSec=600 [Service] Type=simple -RestartSec=5s +RestartSec=3 Restart=always KillMode=process SyslogIdentifier=xbindkeys -- cgit v1.2.3