Enable all the background services with:
systemctl --user enable --now haris-background.target
Note: Clipmenud is started by startx to ensure a graphical session exists.
[Unit]
Description=Background services
Wants=crontab-listen-update.service
Wants=emacs.service
Wants=irc.service
Wants=verm.service
Wants=ssh-agent.service
Wants=vpn-notifier.service
# Wants=clipmenud.service
AllowIsolate=yes
[Install]
WantedBy=default.target
NOTE: The CM_DIR
environment variable was overridden here.
[Unit]
Description=Clipboard daemon
[Service]
Environment=CM_DEBUG=1
Environment=CM_MAX_CLIPS=99999
Environment=XDG_RUNTIME_DIR=/run/user/%U
ExecStart=/usr/bin/env clipmenud
[Install]
WantedBy=default.target
[Unit]
Description=Jira Branch Transformer
[Service]
ExecStart=/usr/bin/env jira-branch-transformer
[Install]
WantedBy=default.target
while :; do
echo "Scanning clipboard..."
cb="$(timeout 1s xsel -bo)"
if grep -qE <<<"$cb" "^git checkout -b [A-Z]+-[0-9]+"; then
echo "Clipboard matched. Transforming to branch name..."
get-branch
fi
sleep 2
done
[Unit]
Description=VPN notifier
[Service]
Environment=XDG_RUNTIME_DIR=/run/user/%U
ExecStart=/usr/bin/env vpn-notifier
SyslogIdentifier=vpn-notifier
[Install]
WantedBy=default.target
I define my main users cron jobs in files matching the glob ~/.haris/cron.d/crontab.*
.
PATH=<<eval-path-env()>>
* * * * * handle-low-bat
0 */2 * * 1-6 website-healthcheck
0 20 */4 * 1-6 website-healthcheck --notify-success
0 18-23 10 */2 * notify-send 'REMINDER' 'Reissue SSL certificate for veracioux.me'
0 20 * * * fish -c 'fish_update_completions'
This service updates the user’s crontab when any of the custom crontab files change.
[Unit]
Description=Crontab change listener and updater
[Service]
ExecStart=<<eval-user-home()>>.local/bin/crontab-listen-update
Restart=on-failure
[Install]
WantedBy=default.target
if ! which inotifywait 2>/dev/null; then
echo "ERROR: inotifywait is not installed. Aborting."
exit 1
fi
mkdir -p ~/.haris/cron.d/
while :; do
content=''
for file in ~/.haris/cron.d/*; do
echo "Read crontab file: $file"
content="$(
echo "$content"
echo
echo "############## START $file"
echo
cat "$file"
echo
echo "############## END $file"
)"
done
echo "$content" | crontab -
echo "Resulting content of crontab:"
crontab -l
echo
inotifywait -e modify -e attrib -e create -e delete ~/.haris/cron.d/
done
(getenv "HOME")
(getenv "PATH")
(getenv "XDG_RUNTIME_DIR")