Skip to content

Instantly share code, notes, and snippets.

@WordlessEcho
Created December 16, 2017 08:54
Show Gist options
  • Save WordlessEcho/2e73c03e0999906b5442b7d8bea078fb to your computer and use it in GitHub Desktop.
Save WordlessEcho/2e73c03e0999906b5442b7d8bea078fb to your computer and use it in GitHub Desktop.
# Thanks for https://github.com/fatedier/frp/issues/145#issuecomment-256967035
# Change for origin: user nobody, save frp at /usr/bin/frp/ (same of https://aur.archlinux.org/packages/frp/)
#!/bin/sh
NAME=frps
DAEMON=/usr/bin/frp/$NAME
CONFIG=/etc/frp/$NAME.ini
[ -x "$DAEMON" ] || exit 0
case "$1" in
start)
echo "Starting $NAME..."
start-stop-daemon --start --chuid nobody --exec $DAEMON --quiet --oknodo --background -- -c $CONFIG || return 2
;;
stop)
echo "Stopping $NAME..."
start-stop-daemon --stop --exec $DAEMON --quiet --oknodo --retry=TERM/30/KILL/5 || return 2
;;
restart)
$0 stop && sleep 2 && $0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment