Skip to content

Instantly share code, notes, and snippets.

@bborysenko
Created February 1, 2018 09:23
Show Gist options
  • Select an option

  • Save bborysenko/41dde80e1d82481c82b2aed956a38089 to your computer and use it in GitHub Desktop.

Select an option

Save bborysenko/41dde80e1d82481c82b2aed956a38089 to your computer and use it in GitHub Desktop.
s6 service manage
#!/bin/sh
SERVICE_DIR=/etc/service/$1
COMMAND=$2
if test ! -d $SERVICE_DIR; then
echo "Service not found: $1" >&2
exit 1
fi
case $COMMAND in
restart)
s6-svc -d -wd $SERVICE_DIR
s6-svc -u $SERVICE_DIR
;;
start)
s6-svc -u $SERVICE_DIR
;;
status)
echo "Service: $SERVICE_DIR"
echo " Status: $(s6-svstat $SERVICE_DIR)"
;;
stop)
s6-svc -d $SERVICE_DIR
;;
*)
echo "Unknown command: $COMMAND" >&2
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment