aboutsummaryrefslogtreecommitdiff
path: root/network/nordvpn/rc.nordvpn
diff options
context:
space:
mode:
authorReza Talebi <reza.talebi.73@outlook.com>2019-08-30 07:51:51 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2019-08-30 07:51:51 +0700
commitea94c6f09a575554f312fbf2a93437402a75f969 (patch)
treeea90bbce72e221a543f753a18d197e77d7a3c86b /network/nordvpn/rc.nordvpn
parent995ea5181357a7d9e418af5dca9e8c6663a12301 (diff)
network/nordvpn: Added (Protect your privacy online).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'network/nordvpn/rc.nordvpn')
-rw-r--r--network/nordvpn/rc.nordvpn91
1 files changed, 91 insertions, 0 deletions
diff --git a/network/nordvpn/rc.nordvpn b/network/nordvpn/rc.nordvpn
new file mode 100644
index 000000000000..c59bb600739a
--- /dev/null
+++ b/network/nordvpn/rc.nordvpn
@@ -0,0 +1,91 @@
+#!/usr/bin/env bash
+
+# Short-Description: Protect your privacy online and access media content with no regional restrictions. Strong encryption and no-log policy with 3000+ servers in 60+ countries.
+### END INIT INFO
+
+
+PRGNAM=nordvpn
+PID=/var/run/$PRGNAM.pid
+DAEMON=/usr/sbin/${PRGNAM}d
+SOCK=/run/${PRGNAM}d.sock
+
+
+#
+# Function that starts the daemon
+#
+nordvpnd_start()
+{
+ rm -rf $SOCK
+ if [ -s $PID ]; then
+ echo "$PRGNAM is already running: $(cat $PID)"
+ exit 1
+ fi
+
+ if [ -x $DAEMON ]; then
+ echo "Starting $PRGNAM"
+ $DAEMON &
+ pidof $DAEMON > $PID
+ fi
+}
+
+#
+# Function that stops the daemon
+#
+nordvpnd_stop()
+{
+ if [ -s $PID ]; then
+ kill $(cat $PID)
+ rm -rf $PID $SOCK
+ echo "$PRGNAM has been stopped."
+ else
+ echo "$PRGNAM is not running."
+ fi
+}
+
+#
+# Function that restarts the daemon
+#
+nordvpnd_restart()
+{
+ echo "Stopping $PRGNAM"
+ sleep 1
+ nordvpnd_stop
+ echo "$PRGNAM has been stopped."
+ sleep 1
+ echo "Restarting $PRGNAM"
+ sleep 1
+ nordvpnd_start
+ echo "$PRGNAM has been restarted."
+}
+
+#
+# Function that shows the current status of the daemon
+#
+nordvpnd_status()
+{
+ if [ -s $PID ]; then
+ echo "$PRGNAM is running: $(cat $PID)"
+ else
+ echo "$PRGNAM is not running."
+ fi
+}
+
+
+case "$1" in
+ start)
+ nordvpnd_start
+ ;;
+ stop)
+ nordvpnd_stop
+ ;;
+ restart)
+ nordvpnd_restart
+ ;;
+ status)
+ nordvpnd_status
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac