#!/sbin/openrc-run name="semaphore" description="Semaphore Service" command="/usr/bin/semaphore" command_args="server --config /var/lib/semaphore/config.json" command_user="semaphore" pidfile="/run/semaphore.pid" depend() { need net after firewall } start_pre() { checkpath -d -m 0755 -o semaphore:semaphore /run checkpath -d -m 0755 -o semaphore:semaphore /var/log/semaphore } start() { ebegin "Starting ${RC_SVCNAME}" start-stop-daemon -v --start \ -1 /var/log/semaphore/current.log \ -2 /var/log/semaphore/error.log \ --user ${command_user} \ --exec ${command} \ --pidfile ${pidfile} \ --make-pidfile \ --background \ -- ${command_args} eend $? } stop() { ebegin "Stopping ${RC_SVCNAME}" start-stop-daemon --stop \ --pidfile ${pidfile} \ --retry TERM/30/KILL/5 eend $? }