mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-29 13:00:32 +01:00
42 lines
565 B
Bash
42 lines
565 B
Bash
#!/bin/bash
|
|
|
|
PIDFILE="/var/lib/tor/tor.pid"
|
|
|
|
tor_start() {
|
|
echo -n "Starting tor: "
|
|
if [ ! -f $PIDFILE ]; then
|
|
/usr/bin/tor 1> /dev/null
|
|
echo "OK"
|
|
else
|
|
echo -n "Removing stale lock.. "
|
|
rm -f $PIDFILE
|
|
/usr/bin/tor 1> /dev/null
|
|
echo "OK"
|
|
fi
|
|
}
|
|
|
|
tor_stop() {
|
|
echo -n "Stopping tor: "
|
|
if [ -f $PIDFILE ]; then
|
|
killall tor &> /dev/null
|
|
rm -f $PIDFILE
|
|
echo "OK"
|
|
else
|
|
echo "Not Running"
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
start)
|
|
tor_start
|
|
;;
|
|
stop)
|
|
tor_stop
|
|
;;
|
|
restart)
|
|
tor_stop
|
|
tor_start
|
|
;;
|
|
*)
|
|
echo "Usage: rc.tor {start|stop|restart}"
|
|
esac
|