Created
February 1, 2018 09:23
-
-
Save bborysenko/41dde80e1d82481c82b2aed956a38089 to your computer and use it in GitHub Desktop.
s6 service manage
This file contains hidden or 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 | |
| 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