mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-21 19:42:24 +01:00
902f5f2dbe
Let's investigate 32bit system thingy later, shall we? Signed-off-by: Pouria Rezaei <Pouria.rz@outlook.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
79 lines
1 KiB
Bash
79 lines
1 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
PRGNAM=helper
|
|
PID=/var/run/$PRGNAM.pid
|
|
DAEMON=/opt/windscribe/helper
|
|
|
|
|
|
#
|
|
# Function that starts the daemon
|
|
#
|
|
windscribe_start()
|
|
{
|
|
if [ -s $PID ]; then
|
|
echo "Windscribe is already running: $(cat $PID)"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -x $DAEMON ]; then
|
|
$DAEMON &
|
|
pidof $DAEMON > $PID
|
|
fi
|
|
}
|
|
|
|
#
|
|
# Function that stops the daemon
|
|
#
|
|
windscribe_stop()
|
|
{
|
|
if [ -s $PID ]; then
|
|
kill $(cat $PID)
|
|
rm -rf $PID
|
|
else
|
|
echo "Windscribe is not running."
|
|
fi
|
|
}
|
|
|
|
#
|
|
# Function that restarts the daemon
|
|
#
|
|
windscribe_restart()
|
|
{
|
|
windscribe_stop
|
|
sleep 1
|
|
windscribe_start
|
|
}
|
|
|
|
#
|
|
# Function that shows the current status of the daemon
|
|
#
|
|
windscribe_status()
|
|
{
|
|
if [ -s $PID ]; then
|
|
echo "Windscribe is running: $(cat $PID)"
|
|
else
|
|
echo "Windscribe is not running."
|
|
fi
|
|
}
|
|
|
|
|
|
case "$1" in
|
|
start)
|
|
windscribe_start
|
|
;;
|
|
stop)
|
|
windscribe_stop
|
|
;;
|
|
restart)
|
|
windscribe_restart
|
|
;;
|
|
status)
|
|
windscribe_status
|
|
;;
|
|
*)
|
|
echo $"Usage: $0 {start|stop|restart|status}"
|
|
exit 1
|
|
;;
|
|
esac
|