diff options
author | Ryan S. Northrup <northrup@yellowapple.us> | 2019-09-28 10:08:58 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2019-09-28 10:08:58 +0700 |
commit | e640f01fbacf9a1ae6c211318ee7321df2e4bb0d (patch) | |
tree | 96dcaaff89a6d86cfa56601f4a6bfa0452c7d1a9 /network/anydesk/rc.anydesk | |
parent | 6c794323a08d126f1cbaa901bb18f42f3fc3cbf4 (diff) | |
download | slackbuilds-e640f01fbacf9a1ae6c211318ee7321df2e4bb0d.tar.gz |
network/anydesk: Added (Remote Desktop Software).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/anydesk/rc.anydesk')
-rw-r--r-- | network/anydesk/rc.anydesk | 80 |
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 |