systemd user service

This commit is contained in:
Linus Nuber committed 2026-10-20 23:40:58 +02:00
1 parent b6669d0c4c
commit 9ebbf7536d
3 files changed
+36 -41

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
[Unit]
Description=Control daemon für browser / keepass Start
After=network.target
[Service]
Type=simple
ExecStart=/sync/data/Linus/scripts/keepassctl
Restart=on-failure
[Install]
WantedBy=default.target
+22 -6
View File
@@ -3,10 +3,26 @@
statedir="/tmp/keepassxc"
fifo="$statedir/fifo"
#exec 2> "$statedir/error.log"
# Client side
#
if [ "$#" -ge 1 ]; then
case "$1" in
keepass)
shift
echo "start-keepass $@" > "$fifo"
;;
browser)
shift
echo "start-browser $@" > "$fifo"
;;
esac
exit 0
fi
# Server side
#
CNTR=0
RUNTIME=10 # Sekunden
RUNTIME=600 # Sekunden
keepass_running()
{
@@ -27,14 +43,14 @@ start_keepass()
tick()
{
echo "tick" > "$fifo"
#echo "tick"
echo "tick" > "$fifo" &
}
mkdir -p "$statedir"
test -e "$fifo" || mkfifo "$fifo"
exec 2> "$statedir/error.log"
tick &
tick
while true; do
read l < "$fifo"
set -- $l
@@ -66,6 +82,6 @@ while true; do
exit 0
;;
esac
tick &
tick
done
+3 -35
View File
@@ -1,37 +1,5 @@
#!/bin/bash
statedir="/tmp/keepassxc"
mkdir -p "$statedir"
pidfile="$statedir/pid"
keepass_running()
{
test -e "$pidfile" && {
KPID="$(<$pidfile)"
if ps -q "$KPID" >/dev/null 2>&1; then
zenity --info --text "Keepass läuft schon unter pid $KPID"
return 0
fi
rm "$pidfile"
}
return 1
}
start_keepass()
{
if ! keepass_running; then
flatpak run org.keepassxc.KeePassXC --pw-stdin --minimized "$@" \
~/Nextcloud/data/Gemeinsam/keepass/LinusKeyPass.kdbx \
< ~/.local/share/keepass &> /dev/null &
STAT=$?
echo "$!" > "$pidfile"
return $STAT
fi
return 0
}
start_keepass
flatpak run org.keepassxc.KeePassXC --pw-stdin --minimized "$@" \
~/Nextcloud/data/Gemeinsam/keepass/LinusKeyPass.kdbx \
< ~/.local/share/keepass &> /dev/null &