summaryrefslogtreecommitdiffstats
path: root/network/anydesk/rc.anydesk
diff options
context:
space:
mode:
Diffstat (limited to 'network/anydesk/rc.anydesk')
-rw-r--r--network/anydesk/rc.anydesk80
1 files changed, 80 insertions, 0 deletions
diff --git a/network/anydesk/rc.anydesk b/network/anydesk/rc.anydesk
new file mode 100644
index 0000000000..38675e3741
--- /dev/null
+++ b/network/anydesk/rc.anydesk
@@ -0,0 +1,80 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Short-Description: AnyDesk global service
+### END INIT INFO
+
+DESC="AnyDesk global service"
+PRGNAM=anydesk
+DAEMON=/usr/bin/$PRGNAM
+OPTS="--service"
+PID=/var/run/$PRGNAM.pid
+
+# Gracefully exit if the package has been removed.
+test -x $DAEMON || exit 0
+
+
+#
+# Function that starts the daemon/service.
+#
+anydesk_start(){
+ if [ -s $PID ]; then
+ echo "$DESC is already running: $(cat $PID)"
+ exit 1
+ fi
+
+ if [ -x $DAEMON ]; then
+ echo "Starting $DESC"
+ $DAEMON -- $OPTS &
+ pidof $DAEMON > $PID
+ fi
+}
+#
+# Function that stops the daemon/service.
+#
+anydesk_stop()
+{
+ if [ -e $PID ]; then
+ kill $(cat $PID)
+ killall $PRGNAM
+ rm -rf $PID
+ echo "$DESC has been stopped."
+ else
+ echo "$DESC is not running."
+ fi
+}
+
+#
+# Function that shows the current status of the daemon/service.
+#
+anydesk_status()
+{
+ if [ -s $PID ]; then
+ echo "$DESC is running: $(cat $PID)"
+ else
+ echo "$DESC is not running."
+ fi
+}
+
+
+case "$1" in
+ start)
+ anydesk_start
+ ;;
+ stop)
+ anydesk_stop
+ ;;
+ restart|force-reload)
+ anydesk_stop
+ sleep 2
+ anydesk_start
+ ;;
+ status)
+ anydesk_status
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0