aboutsummaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-04-08 21:56:30 +0200
committerKarel Kočí <cynerd@email.cz>2017-04-08 21:56:30 +0200
commit3b15d8dcd8912825281367ed959d7ad212e6a0ab (patch)
tree3424d6ae34c3da6dc7303d1a36cf8573d2ac1c54 /service
parent8d39ed9e2804c6c9ed42aa685f6eb2f7c38fbbea (diff)
downloadmyconfigs-3b15d8dcd8912825281367ed959d7ad212e6a0ab.tar.gz
myconfigs-3b15d8dcd8912825281367ed959d7ad212e6a0ab.tar.bz2
myconfigs-3b15d8dcd8912825281367ed959d7ad212e6a0ab.zip
Add user services
Diffstat (limited to 'service')
-rwxr-xr-xservice/mpd23
-rwxr-xr-xservice/syncthing19
2 files changed, 42 insertions, 0 deletions
diff --git a/service/mpd b/service/mpd
new file mode 100755
index 0000000..4f0f467
--- /dev/null
+++ b/service/mpd
@@ -0,0 +1,23 @@
+#!/home/cynerd/.local/sbin/user-service.sh
+# vim: ft=sh
+
+description="Music player daemon"
+pidfile=".config/mpd/pid"
+
+MPD_PID=~/.config/mpd/pid
+if [ ! -e $MPD_PID ] || ! kill -0 $(cat $MPD_PID); then
+ mpd ~/.config/mpd/mpd.conf
+fi
+
+status() {
+ [ -f $pidfile ] || return 1
+ kill -0 "$(cat $pidfile)" || return 1
+}
+
+start() {
+ mpd ~/.config/mpd/mpd.conf
+}
+
+stop() {
+ mpd --kill ~/.config/mpd/mpd.conf
+}
diff --git a/service/syncthing b/service/syncthing
new file mode 100755
index 0000000..8d0e009
--- /dev/null
+++ b/service/syncthing
@@ -0,0 +1,19 @@
+#!/home/cynerd/.local/sbin/user-service.sh
+# vim: ft=sh
+
+description="Syncthing is an open, trustworthy and decentralized cloud storage system"
+pidfile="/tmp/syncthing-$USER.pid"
+logfile="/var/log/syncthing-$USER.log"
+
+status() {
+ [ -f $pidfile ] || return 1
+ kill -0 "$(cat $pidfile)" || return 1
+}
+
+start() {
+ start-stop-daemon -S -bmp $pidfile -1 $logfile -2 $logfile -- syncthing -no-browser
+}
+
+stop() {
+ start-stop-daemon -K -p $pidfile -x syncthing
+}