GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contributor
You can install MTProxy as a systemd service. Example:
[Unit]
Description=MTProxy
After=network.target
[Service]
WorkingDirectory=/opt/mtproxy
ExecStart=/opt/mtproxy/mtproto-proxy -u nobody -p 8888 -H 443 -S 77f059e1822e2b23e84eda9c5f964091 --aes-pwd proxy-secret proxy-multi.conf -M 1
[Install]
WantedBy=multi-user.target
You can install MTProxy as a systemd service. Example:
[Unit]
Description=MTProxy
After=network.target
[Service]
WorkingDirectory=/opt/mtproxy
ExecStart=/opt/mtproxy/mtproto-proxy -u nobody -p 8888 -H 443 -S 77f059e1822e2b23e84eda9c5f964091 --aes-pwd proxy-secret proxy-multi.conf -M 1
[Install]
WantedBy=multi-user.target
Same for me. I use start-stop-daemon
Upd: use the example above by @loskiq unless your Linux is very old and doesn't support systemd
#!/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
Same for me. I use start-stop-daemon
Upd: use the example above by @loskiq unless your Linux is very old and doesn't support systemd
#!/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