48 lines
1021 B
Plaintext
48 lines
1021 B
Plaintext
#!/sbin/openrc-run
|
|
|
|
. /etc/conf.d/mastodon
|
|
|
|
name="Mastodon background workers Service"
|
|
pidfile="${INSTALLROOT}/worker.pid"
|
|
|
|
depend() {
|
|
use net
|
|
need redis-server
|
|
}
|
|
|
|
pre_start() {
|
|
if [ "${RC_CMD}" != "restart" ] ; then
|
|
for run in {1..10}; do
|
|
status="$(redis-cli ping)"
|
|
if [[ "$status" == "PONG" ]]; then
|
|
exit 0
|
|
fi
|
|
sleep 1
|
|
done
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
start() {
|
|
ebegin "Starting Mastodon background workers"
|
|
|
|
start-stop-daemon --start \
|
|
--chdir "${INSTALLROOT}" \
|
|
--user="${USER}" \
|
|
--pidfile="${pidfile}" \
|
|
-3 logger \
|
|
-4 logger \
|
|
-C -b -m \
|
|
--exec /usr/bin/env -- RAILS_ENV=production DB_POOL=${DB_POOL} \
|
|
bundle exec sidekiq -c ${SIDEKIQ_WORKERS} -q default,8 -q scheduler,1 -q mailers,1 -q push,6 -q ingress,4 -q pull,1 -q fasp
|
|
eend $?
|
|
}
|
|
|
|
stop() {
|
|
ebegin "Stopping Mastodon background workers"
|
|
start-stop-daemon --stop \
|
|
--pidfile=${pidfile} \
|
|
eend $?
|
|
}
|
|
|