From 83204601bd91accc45965897e4d87daa9d67636b Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Fri, 16 Oct 2020 10:25:48 +0200 Subject: [PATCH] simplify service definitions --- .gitignore | 1 + services/notmuch/notmuch | 11 ----------- services/notmuch/run | 24 ++++++++++++++++-------- services/spotifyd/run | 18 +++++++++--------- services/vdirsyncer/run | 24 ++++++++++++++++-------- services/vdirsyncer/vdirsyncer | 11 ----------- 6 files changed, 42 insertions(+), 47 deletions(-) delete mode 100755 services/notmuch/notmuch delete mode 100755 services/vdirsyncer/vdirsyncer diff --git a/.gitignore b/.gitignore index 57994c6..d62e070 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ vim/spell services/*/supervise services/*/lock services/*/current +services/*/down # other *.pyc diff --git a/services/notmuch/notmuch b/services/notmuch/notmuch deleted file mode 100755 index fec8175..0000000 --- a/services/notmuch/notmuch +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -e - -# check for internet connection -ip route ls | grep -q '.' - -# check if the gpg-agent is running -pgrep gpg-agent > /dev/null - -notmuch new --quiet 2>&1 - -exec sleep 1m diff --git a/services/notmuch/run b/services/notmuch/run index b02984a..41225b4 100755 --- a/services/notmuch/run +++ b/services/notmuch/run @@ -1,9 +1,17 @@ #!/bin/sh -exec env \ - HOME="${HOME:-/home/noctua}" \ - XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-/home/noctua/.config}" \ - LC_ALL="en_US.utf-8" \ - LANG="en_US.utf-8" \ - PATH="/usr/local/bin:$HOME/.local/bin:$PATH" \ - DISPLAY="${DISPLAY:-:0}" \ - ./notmuch +export USER="$(whoami)" +export HOME=/home/"$USER" +export DISPLAY=":0" +. "$HOME"/.profile + +set -e + +# check for internet connection +ip route ls | grep -q '.' + +# check if the gpg-agent is running +pgrep gpg-agent > /dev/null + +notmuch new --quiet 2>&1 + +exec sleep 1m diff --git a/services/spotifyd/run b/services/spotifyd/run index e3aefb0..757f320 100755 --- a/services/spotifyd/run +++ b/services/spotifyd/run @@ -1,9 +1,9 @@ -#!/bin/sh -e -exec > /dev/null -exec env -i \ - HOME="${HOME:-/home/noctua}" \ - XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-/home/noctua/.config}" \ - XDG_CACHE_HOME="${XDG_CONFIG_HOME:-/home/noctua/.cache}" \ - PATH="/usr/local/bin:$HOME/.cargo/bin:$PATH" \ - DISPLAY=":0" \ - /home/noctua/.cargo/bin/spotifyd --no-daemon +#!/bin/sh +export USER="$(whoami)" +export HOME=/home/"$USER" +export DISPLAY=":0" +. "$HOME/.profile" + +spotifyd --no-daemon 2>&1 \ + | tee -a $XDG_RUNTIME_DIR/playlist \ + | sed '/trunc/d;/loaded$/d;/^Loading/d' diff --git a/services/vdirsyncer/run b/services/vdirsyncer/run index 8810fc7..a706016 100755 --- a/services/vdirsyncer/run +++ b/services/vdirsyncer/run @@ -1,9 +1,17 @@ #!/bin/sh -exec env \ - HOME="${HOME:-/home/noctua}" \ - XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-/home/noctua/.config}" \ - LC_ALL="en_US.utf-8" \ - LANG="en_US.utf-8" \ - PATH="/usr/local/bin:$HOME/.local/bin:$PATH" \ - DISPLAY="${DISPLAY:-:0}" \ - ./vdirsyncer +export USER="$(whoami)" +export HOME=/home/"$USER" +export DISPLAY=":0" +. "$HOME"/.profile + +set -e + +# check for internet connection +ip route ls | grep -q '.' + +# check if the gpg-agent is running +pgrep gpg-agent > /dev/null + +vdirsyncer -v CRITICAL sync 2>&1 + +exec sleep 10m diff --git a/services/vdirsyncer/vdirsyncer b/services/vdirsyncer/vdirsyncer deleted file mode 100755 index 956d53d..0000000 --- a/services/vdirsyncer/vdirsyncer +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -e - -# check for internet connection -ip route ls | grep -q '.' - -# check if the gpg-agent is running -pgrep gpg-agent > /dev/null - -vdirsyncer -v CRITICAL sync 2>&1 - -exec sleep 10m