Created
December 10, 2018 06:39
-
-
Save rockstar2046/6180eaf4112d8fedc96757ea0a8e45e3 to your computer and use it in GitHub Desktop.
Run script as system service
This file contains 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/sh | |
### BEGIN INIT INFO | |
# Provides: shadowsocks server | |
# Required-Start: $local_fs $remote_fs $named $network $time | |
# Required-Stop: $local_fs $remote_fs $named $network $time | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 | |
# Short-Description: Shadowsocks server | |
# Description: Shadowsocks proxy server | |
### END INIT INFO | |
# Author: RA <[email protected]> | |
do_start(){ | |
# check command | |
type ss-server > /dev/null 2>&1 | |
if [ $? -ne 0 ] | |
then | |
echo "Program need 'ss-server', please install them, -_-" | |
exit 1; | |
fi | |
ss-server -p 8003 -k PASSWORD -m aes-128-cfb -t 300 > /dev/null 2>&1 & | |
} | |
do_stop(){ | |
pkill ss-server > /dev/null 2>&1 | |
} | |
case "$1" in | |
reload|force-reload|status) | |
echo "not support" | |
;; | |
stop) | |
do_stop;; | |
restart) | |
do_stop | |
do_start | |
;; | |
start) | |
do_start | |
;; | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment