aboutsummaryrefslogtreecommitdiff
path: root/network/ptokax/rc.ptokax
blob: 8fd308095baf2fd9c595d28c94424be86e376a5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash

NAME=ptokax
PREFIX=/usr
DAEMON=$PREFIX/bin/${NAME}
CONFIG=/etc/${NAME}/

start() {
    pid=$(pidof -o %PPID $NAME)
    if [[ -z $pid ]]; then
        echo "Start services: $NAME"
        $DAEMON -d -c $CONFIG 2>&1 >> /dev/null
    else
        echo "Services $NAME already running."
    fi
}

stop() {
    echo "Stop services: $NAME."
    killall -9 $NAME 2> /dev/null
}

restart() {
    stop
    sleep 2
    start
}

case $1 in
'start')
  start
  ;;
'stop')
  stop
  ;;
'restart')
  restart
  ;;
*)
  echo "Usage $0 {start|stop|restart}"
esac