Created
September 22, 2018 18:34
-
-
Save frou/31f6b305f619d3bdb96f84c72150cc06 to your computer and use it in GitHub Desktop.
Alpine initscript for yt2pod
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
#!/sbin/openrc-run | |
APP_USER="$RC_SVCNAME" | |
APP_DIR="/home/$APP_USER/app" | |
BINARY="$APP_DIR/$RC_SVCNAME" | |
BINARY_ARGS="-syslog -dataclean" | |
LOG_OUT="$APP_DIR/out.log" | |
LOG_ERR="$APP_DIR/err.log" | |
LOG_PID="$APP_DIR/pid.log" | |
STARTED_OK_AFTER_MS=5000 | |
depend() { | |
need net | |
need localmount | |
} | |
start() { | |
ebegin "Starting $RC_SVCNAME" | |
start-stop-daemon --exec "$BINARY" \ | |
--start \ | |
--background \ | |
--chdir "$APP_DIR" \ | |
--user "$APP_USER" \ | |
--make-pidfile \ | |
--pidfile "$LOG_PID" \ | |
--stdout "$LOG_OUT" \ | |
--stderr "$LOG_ERR" \ | |
--wait "$STARTED_OK_AFTER_MS" \ | |
-- \ | |
$BINARY_ARGS | |
eend $? | |
} | |
stop() { | |
ebegin "Stopping $RC_SVCNAME" | |
start-stop-daemon --exec "$BINARY" \ | |
--stop \ | |
--pidfile "$LOG_PID" | |
eend $? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment