]>
git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - support/init.d/peertube
7 APP_DIR
="/var/www/peertube/peertube-latest"
10 CONFIG_DIR
="/var/www/peertube/config"
11 PID_DIR
="$APP_DIR/pid"
12 PID_FILE
="$PID_DIR/$APP_NAME.pid"
13 LOG_DIR
="/var/log/peertube"
14 LOG_FILE
="$LOG_DIR/$APP_NAME.log"
15 NODE_EXEC
=$(which node)
19 # REDHAT chkconfig header
22 # description: peertube service script.
25 # Required-Start: $network $remote_fs $local_fs
26 # Required-Stop: $network $remote_fs $local_fs
27 # Default-Start: 2 3 4 5
29 # Short-Description: start and stop peertube
30 # Description: Node process for peertube
35 USAGE
="Usage: $0 {start|stop|restart|status} [--force]"
43 echo "$(cat "$PID_FILE")"
53 chown
$USER:$GROUP "$PID_DIR"
55 chown
$USER:$GROUP "$LOG_DIR"
57 echo "Starting $APP_NAME ..."
58 echo "cd $APP_DIR && NODE_ENV=$NODE_ENV NODE_CONFIG_DIR=$CONFIG_DIR $NODE_EXEC $APP_DIR/$NODE_APP $KWARGS 1>$LOG_FILE 2>&1 & echo \$! > $PID_FILE" | sudo
-i -u $USER
59 echo "$APP_NAME started with pid $(get_pid)"
64 echo "Killing process $PID"
69 echo "Removing pid file"
79 echo "$APP_NAME already running with pid $PID"
82 echo "$APP_NAME stopped, but pid file exists"
83 if [ $FORCE_OP = true
]
85 echo "Forcing start anyways"
100 echo "Stopping $APP_NAME ..."
103 echo "$APP_NAME stopped"
105 echo "$APP_NAME already stopped, but pid file exists"
106 if [ $FORCE_OP = true
]
108 echo "Forcing stop anyways ..."
110 echo "$APP_NAME stopped"
116 echo "$APP_NAME already stopped, pid file does not exist"
127 echo "$APP_NAME running with pid $PID"
129 echo "$APP_NAME stopped, but pid file exists"
132 echo "$APP_NAME stopped"