ref: master
init.d/hometown-web
#!/sbin/openrc-run name="hometown-web" description="hometown web service" HOMETOWN_USER=${HOMETOWN_USER:-deployer} LOGS=/var/log/hometown-web.log depend() { need net use redis use postgresql } start_pre() { checkpath -f "$LOGS" -m 644 -o "$HOMETOWN_USER:$HOMETOWN_USER" } start() { ebegin "Starting $name" cd /srv/hometown export RAILS_ENV=production start-stop-daemon \ -u ${HOMETOWN_USER} \ -1 "$LOGS" \ -2 "$LOGS" \ --background \ --make-pidfile \ --pidfile /run/$name.pid \ --exec /usr/bin/bundle -- \ exec puma -C config/puma.rb eend $? } stop() { ebegin "Stopping $name" start-stop-daemon --stop --exec /usr/bin/bundle --pidfile /run/$name.pid eend $? }