#!/bin/sh ### BEGIN INIT INFO # Provides: hbbs # Required-Start: $network # Required-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Rust HBBS ### END INIT INFO # Path to the executable DAEMON=/opt/rustdesk/hbbs >>/var/log/rustdesk/signalserver.log 2>>/var/log/rustdesk/signalserver.error DAEMON_NAME=hbbs PIDFILE=/var/run/$DAEMON_NAME.pid start() { echo "Starting $DAEMON_NAME..." if [ -f $PIDFILE ]; then echo "$DAEMON_NAME is already running." return 1 fi $DAEMON & echo $! > $PIDFILE echo "$DAEMON_NAME started." } stop() { echo "Stopping $DAEMON_NAME..." if [ ! -f $PIDFILE ]; then echo "$DAEMON_NAME is not running." return 1 fi kill $(cat $PIDFILE) rm -f $PIDFILE echo "$DAEMON_NAME stopped." } status() { if [ -f $PIDFILE ]; then echo "$DAEMON_NAME is running." else echo "$DAEMON_NAME is not running." fi } case "$1" in start) start ;; stop) stop ;; status) status ;; restart) stop start ;; *) echo "Usage: $0 {start|stop|status|restart}" exit 1 ;; esac exit 0