https://github.com/TelegramMessenger/MTProxy/issues/19
#!/bin/sh
### BEGIN INIT INFO
# Provides: mtproto-proxy
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: MTProxy service
### END INIT INFO
set -e
# Must be a valid filename
NAME=mtproto-proxy
PIDFILE=/var/run/$NAME.pid
#This is the command to be run, give the full pathname
DAEMON=/usr/bin/mtproto-proxy
DIR=/opt/MTProxy
DAEMON_OPTS=$(cat ${DIR}/options.txt)
USER=root
export PATH="${PATH:+$PATH:}/usr/sbin:/sbin"
case "$1" in
start)
echo -n "Starting daemon: "$NAME
start-stop-daemon --start --background --pidfile $PIDFILE -d $DIR -m --exec $DAEMON -- $DAEMON_OPTS
echo "."
;;
stop)
echo -n "Stopping daemon: "$NAME
start-stop-daemon --stop --signal TERM --quiet --oknodo --pidfile $PIDFILE
echo "."
sleep 3
;;
restart)
echo -n "Restarting daemon: "$NAME
start-stop-daemon --stop --signal TERM --quiet --oknodo --retry 30 --pidfile $PIDFILE
start-stop-daemon --start --background --pidfile $PIDFILE -d $DIR -m --exec $DAEMON -- $DAEMON_OPTS
echo "."
;;
*)
echo "Usage: "$1" {start|stop|restart}"
exit 1
esac
exit 0
1
torbrowserbridge 2018-07-10 11:01:09 +08:00
ExecStart=/opt/MTProxy/mtproto-proxy -u nobody -p 8888 -H 443 -S <secret> -P <proxy tag> <other params>
这不行? |
2
HiJackXD OP @torbrowserbridge centos6 不行呢...
|
3
jjianwen68 2018-07-10 11:27:11 +08:00
一个方法:从 /etc/init.d 下找个 service,参考着加一个 service
|
5
ionblue 2018-07-10 12:09:52 +08:00 via Android
crontab 里加一个 @reboot 就可以了。另外,人生已经如此艰难了,何苦再用 CentOS 呢?
|
6
JoyBanana 2018-07-10 12:22:19 +08:00 via iPhone
Google it
|
7
lieh222 2018-07-10 12:35:32 +08:00
/etc/rc.local
|
8
klii 2018-07-10 13:19:43 +08:00 via iPhone
不关机不就行了,服务器就是那种,一年不关机一次的(手动滑稽)另外强推 debian
|
9
HiJackXD OP @jjianwen68
https://github.com/TelegramMessenger/MTProxy/issues/19 看到一个 ``` #!/bin/sh ### BEGIN INIT INFO # Provides: mtproto-proxy # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: # Short-Description: MTProxy service ### END INIT INFO set -e # Must be a valid filename NAME=mtproto-proxy PIDFILE=/var/run/$NAME.pid #This is the command to be run, give the full pathname DAEMON=/usr/bin/mtproto-proxy DIR=/opt/MTProxy DAEMON_OPTS=$(cat ${DIR}/options.txt) USER=root export PATH="${PATH:+$PATH:}/usr/sbin:/sbin" case "$1" in start) echo -n "Starting daemon: "$NAME start-stop-daemon --start --background --pidfile $PIDFILE -d $DIR -m --exec $DAEMON -- $DAEMON_OPTS echo "." ;; stop) echo -n "Stopping daemon: "$NAME start-stop-daemon --stop --signal TERM --quiet --oknodo --pidfile $PIDFILE echo "." sleep 3 ;; restart) echo -n "Restarting daemon: "$NAME start-stop-daemon --stop --signal TERM --quiet --oknodo --retry 30 --pidfile $PIDFILE start-stop-daemon --start --background --pidfile $PIDFILE -d $DIR -m --exec $DAEMON -- $DAEMON_OPTS echo "." ;; *) echo "Usage: "$1" {start|stop|restart}" exit 1 esac exit 0 ``` |
10
nieyujiang 2018-07-10 13:39:30 +08:00 via iPhone
所以为什么要用 centos6
|
11
HiJackXD OP @nieyujiang #10 因为搬瓦工那个一键 ss 只支持 os6 啊 TAT
|
12
trepwq 2018-07-10 13:42:09 +08:00 via iPhone
rc.local
|