Skip to content

Commit

Permalink
Merge branch 'master' of github.com:XX-net/XX-Net
Browse files Browse the repository at this point in the history
  • Loading branch information
xxnet committed Jan 9, 2016
2 parents 02617b3 + 893df81 commit fbc8de7
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


XX-Net - A Reborn of Goagent
XX-Net - A Reborn Goagent
========
翻墙工具套件 A firewall circumvention toolkit
* GAE proxy, 稳定、易用、快速
Expand Down
8 changes: 4 additions & 4 deletions launcher/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,9 @@ def create_desktop_shortcut():
if sys.platform.startswith("linux"):
pass
elif sys.platform == "win32":
import ctypes
msg = u"是否在桌面创建图标?"
title = u"XX-Net 叉叉网"
# import ctypes
# msg = u"是否在桌面创建图标?"
# title = u"XX-Net 叉叉网"
#res = ctypes.windll.user32.MessageBoxW(None, msg, title, 1)
# Yes:1 No:2
#if res == 2:
Expand All @@ -342,7 +342,7 @@ def create_desktop_shortcut():
os.chdir(work_path)

import subprocess
p = subprocess.call(["Wscript.exe", "//E:JScript", "create_shortcut.js"], shell=False)
subprocess.call(["Wscript.exe", "//E:JScript", "create_shortcut.js"], shell=False)

def notify_install_tcpz_for_winXp():
import ctypes
Expand Down
83 changes: 83 additions & 0 deletions xx_net.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/bin/sh
#
# xx_net init script
#

### BEGIN INIT INFO
# Provides: xx_net
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Monitor for xx_net activity
### END INIT INFO

# **NOTE** bash will exit immediately if any command exits with non-zero.
set -e

PACKAGE_NAME=xx_net
PACKAGE_DESC="xx_net proxy server"
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:${PATH}

start() {
echo -n "Starting ${PACKAGE_DESC}: "
if hash python2 2>/dev/null; then
nohup python2 launcher/start.py 2>&1 | /usr/bin/logger -t ${PACKAGE_NAME} &
else
nohup python launcher/start.py 2>&1 | /usr/bin/logger -t ${PACKAGE_NAME} &
fi
echo "${PACKAGE_NAME}."
}

stop() {
echo -n "Stopping ${PACKAGE_DESC}: "
if hash python2 2>/dev/null; then
kill -9 `ps aux | grep 'python2 launcher/start.py' | grep -v grep | awk '{print $2}'` || true
else
kill -9 `ps aux | grep 'python launcher/start.py' | grep -v grep | awk '{print $2}'` || true
fi
echo "${PACKAGE_NAME}."
}

restart() {
stop
sleep 1
start
}

usage() {
N=$(basename "$0")
echo "Usage: [sudo] $N {start|stop|restart}" >&2
exit 1
}

if [ "$(id -u)" != "0" ]; then
echo "please use sudo to run ${PACKAGE_NAME}"
exit 0
fi

# `readlink -f` won't work on Mac, this hack should work on all systems.
cd $(python -c "import os; print os.path.dirname(os.path.realpath('$0'))")

case "$1" in
# If no arg is given, start the goagent.
# If arg `start` is given, also start goagent.
'' | start)
start
;;
stop)
stop
;;
#reload)
restart | force-reload)
restart
;;
*)
usage
;;
esac

exit 0
}

0 comments on commit fbc8de7

Please sign in to comment.