aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinstall5
-rwxr-xr-xlocal/sbin/user-service.sh106
-rw-r--r--profile4
-rwxr-xr-xservice/mpd18
-rwxr-xr-xservice/syncthing19
5 files changed, 1 insertions, 151 deletions
diff --git a/install b/install
index 230801a..47dde80 100755
--- a/install
+++ b/install
@@ -31,11 +31,6 @@ if ask "gnuscreen" "Install configurations for various utility tools"; then
inst screenrc ~/.screenrc
fi
-if ask "services" "Install user services"; then
- inst local/sbin/user-service.sh ~/.local/sbin/user-service.sh
- inst service/ ~/.service/
-fi
-
if ask "ssh" "Install SSH config"; then
inst private/ssh_config ~/.ssh/config
fi
diff --git a/local/sbin/user-service.sh b/local/sbin/user-service.sh
deleted file mode 100755
index 632272c..0000000
--- a/local/sbin/user-service.sh
+++ /dev/null
@@ -1,106 +0,0 @@
-#!/bin/sh
-set -e
-
-[ -z "$1" ] && {echo "Run this script only from user-service file!" && exit 1}
-
-# Name of service
-NAME="$(basename "$1")"
-SERVICE="$1"
-
-# Source input file
-. "$1"
-shift
-
-OP="status"
-Q=true
-# Parse arguments
-while [ -n "$1" ]; do
- case "$1" in
- -h|--help)
- echo "User service: $NAME"
- echo " $description"
- echo "$SERVICE [OPTION]... OPERATION"
- echo " Options:"
- echo " -q - be quiet"
- echo " Operations:"
- echo " status - show status of service"
- echo " start - start service"
- echo " stop - stop service"
- echo " restart - restart service"
- echo " ifrestart - restart service if it's running"
- ;;
- -q)
- Q=false
- ;;
- status|start|stop|restart)
- OP="$1"
- ;;
- *)
- echo "Unknown argument: $1"
- exit 1
- ;;
- esac
- shift
-done
-
-case "$OP" in
- status)
- if status; then
- $Q && echo "Service $NAME is running"
- exit 0
- else
- $Q && echo "Service $NAME is not running"
- exit 1
- fi
- ;;
- start)
- $Q && echo -n "Starting service $NAME..."
- if start; then
- $Q && echo " ok"
- else
- $Q && echo " fail"
- exit 1
- fi
- ;;
- stop)
- $Q && echo -n "Stopping service $NAME..."
- if stop; then
- $Q && echo " ok"
- else
- $Q && echo " fail"
- exit 1
- fi
- ;;
- restart)
- $Q && echo "Restarting service $NAME..."
- if ! stop; then
- $Q && echo " stop failed"
- exit 1
- fi
- if start; then
- $Q && echo " ok"
- else
- $Q && echo " start failed"
- exit 1
- fi
- ;;
- ifrestart)
- $Q && echo "Restarting service $NAME..."
- if status; then
- if ! stop; then
- $Q && echo " stop failed"
- exit 1
- fi
- if start; then
- $Q && echo " ok"
- else
- $Q && echo " start failed"
- exit 1
- fi
- fi
- ;;
- *)
- echo "Invalid operation!"
- exit 3
- ;;
-esac
diff --git a/profile b/profile
index 9c6058f..ee600c9 100644
--- a/profile
+++ b/profile
@@ -10,9 +10,7 @@ export CT_LOCAL_TARBALLS_DIR="~/src/ct-ng"
[[ "$(tty)" != /dev/tty* ]] && return
# Start music player daemon
-~/.service/mpd -q status || ~/.service/mpd start
-# Start syncthing
-~/.service/syncthing -q status || ~/.service/syncthing start
+pgrep mpd >/dev/null || mpd ~/.config/mpd/mpd.conf
# And if we are on first terminal also automatically start x server
if [ "$(tty)" = "/dev/tty1" ]; then
diff --git a/service/mpd b/service/mpd
deleted file mode 100755
index f55722a..0000000
--- a/service/mpd
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/home/cynerd/.local/sbin/user-service.sh
-# vim: ft=sh
-
-description="Music player daemon"
-pidfile=".config/mpd/pid"
-
-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
deleted file mode 100755
index 8d0e009..0000000
--- a/service/syncthing
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/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
-}