Created
December 20, 2012 15:14
-
-
Save billy3321/4345853 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export PIDFILE="/var/run/obfsproxy.pid" | |
export PASS="P@ssw0rd" | |
export DEST="127.0.0.1:22" | |
export SERVER="xx.xx.xx.xx:2222" | |
export DAEMON="obfsproxy --log-min-severity=info obfs2 --shared-secret=${PASS} --dest=${DEST} server ${SERVER}" | |
### BEGIN INIT INFO | |
# Provides: Obfsproxy | |
# Required-Start: | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Obfsproxy | |
### END INIT INFO | |
case "$1" in | |
start) | |
echo "Starting Obfsproxy" | |
# Activate the virtual environment | |
#. /home/ali/wer-gcms/g-env/bin/activate | |
# Run start-stop-daemon, the $DAEMON variable contains the path to the | |
# application to run | |
/sbin/start-stop-daemon --start --pidfile $PIDFILE \ | |
--user www-data --group www-data \ | |
--chuid www-data \ | |
--exec "$DAEMON" | |
;; | |
stop) | |
echo "Stopping Obfsproxy" | |
# Start-stop daemon can also stop the application by sending sig 15 | |
# (configurable) to the process id contained in the run/pid file | |
/sbin/start-stop-daemon --stop --pidfile $PIDFILE --verbose | |
restart|reload) | |
/sbin/start-stop-daemon --stop --pidfile $PIDFILE --verbose | |
sleep 1 | |
/sbin/start-stop-daemon --start --pidfile $PIDFILE \ | |
--user www-data --group www-data \ | |
--chuid www-data \ | |
--exec "$DAEMON" | |
;; | |
*) | |
# Refuse to do other stuff | |
echo "Usage: /etc/init.d/obfsproxy {start|stop|restart|reload}" | |
exit 1 | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment