#!/sbin/openrc-run name="Loomio background workers Service" root="/usr/share/webapps/loomio" pidfile="/run/loomio-sidekiq.pid" logfile="/var/log/loomio/sidekiq.log" depend() { use net need redis } start() { ebegin "Starting Loomio background workers" cd $root start-stop-daemon --start --background \ --chdir "${root}" \ --user="loomio" \ --make-pidfile --pidfile="${pidfile}" \ -1 "${logfile}" -2 "${logfile}" \ --exec /usr/bin/env -- RAILS_ENV=production bundle exec rails s eend $? } stop() { ebegin "Stopping Loomio background workers" start-stop-daemon --stop \ --pidfile=${pidfile} \ eend $? }