Skip to content

Instantly share code, notes, and snippets.

@charles-l
Last active September 10, 2024 14:41
Show Gist options
  • Save charles-l/a9d974ccafe4d9000ae5cb2a522617bc to your computer and use it in GitHub Desktop.
Save charles-l/a9d974ccafe4d9000ae5cb2a522617bc to your computer and use it in GitHub Desktop.
tailscaled sysvinit script for devuan
#!/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
@mralusw
Copy link

mralusw commented Oct 3, 2023

I'm on MX Linux, same problem when running without the (optional) systemd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment