-
-
Save mralusw/882d0dfb0df5305cde2b843d89e7b010 to your computer and use it in GitHub Desktop.
tailscaled sysvinit script for devuan
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: tailscale | |
# Required-Start: $local_fs $all $network | |
# Required-Stop: | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: | |
# Short-Description: Tailscale daemon | |
# Description: Runs the tailscale daemon. | |
### END INIT INFO | |
# Source function library. | |
. /lib/lsb/init-functions | |
PIDFILE=/var/run/tailscale.pid | |
LOGFILE=/var/log/tailscale.log | |
TAILSCALED=/usr/sbin/tailscaled | |
fail_unless_root() { | |
if [ "$(id -u)" != '0' ]; then | |
log_failure_msg "must be run as root" | |
exit 1 | |
fi | |
} | |
case "$1" in | |
start) | |
fail_unless_root | |
$TAILSCALED --cleanup | |
start-stop-daemon --start --background --no-close \ | |
--exec $TAILSCALED \ | |
--pidfile "$PIDFILE" \ | |
--make-pidfile \ | |
-- \ | |
--state=/var/lib/tailscale/tailscaled.state \ | |
--socket=/run/tailscale/tailscaled.sock >> $LOGFILE 2>&1 | |
status=$? | |
log_end_msg $status | |
;; | |
stop) | |
fail_unless_root | |
start-stop-daemon --stop --pidfile "$PIDFILE" \ | |
--remove-pidfile --retry 10 | |
status=$? | |
log_end_msg $status | |
;; | |
status) | |
status_of_proc -p "$PIDFILE" "$TAILSCALED" "tailscaled" | |
;; | |
*) | |
echo "Usage: $0 {start|stop|status}" | |
exit 1 ;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment