Last active
March 27, 2020 06:44
-
-
Save visamz/f40155bb085455f68862 to your computer and use it in GitHub Desktop.
Beanstalkd and Supervisor Config. For CentOS, a modified /etc/init.d/beanstlkd file which creates a pid file in /var/run/beanstalkd.pid
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
For beanstalkd version 1.9, centos 6 | |
su -c 'rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm' | |
su -c 'yum install beanstalkd' | |
chmod 755 beanstalkd | |
chkconfig beanstalkd on | |
service beanstalkd start | |
service beanstalkd status |
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
[program:baciuzzi_queue] | |
directory=/data2/www/baciuzzi | |
command=php artisan queue:listen --tries=3 | |
stdout_logfile=/data2/www/baciuzzi/app/storage/logs/supervisor.log | |
stdout_logfile_maxbytes=1MB | |
stdout_logfile_backups=10 | |
stdout_capture_maxbytes=1MB | |
stderr_logfile=/data2/www/baciuzzi/app/storage/logs/supervisor_error.log | |
stderr_logfile_maxbytes=1MB | |
stderr_logfile_backups=10 | |
stderr_capture_maxbytes=1MB | |
autostart=true | |
autorestart=true |
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
#!/bin/sh | |
# | |
# beanstalkd - a simple, fast workqueue service | |
# | |
# chkconfig: - 57 47 | |
# description: a simple, fast workqueue service | |
# processname: beanstalkd | |
# config: /etc/sysconfig/beanstalkd | |
# | |
### BEGIN INIT INFO | |
# Provides: beanstalkd | |
# Required-Start: $local_fs $network $remote_fs | |
# Required-Stop: $local_fs $network $remote_fs | |
# Default-Stop: 0 1 2 6 | |
# Short-Description: start and stop beanstalkd | |
# Description: a simple, fast work-queue service | |
### END INIT INFO | |
# Source function library. | |
. /etc/rc.d/init.d/functions | |
# Source networking configuration. | |
. /etc/sysconfig/network | |
# Check that networking is up. | |
[ "$NETWORKING" = "no" ] && exit | |
exec="/usr/bin/beanstalkd" | |
prog=$(basename $exec) | |
# default options, overruled by items in sysconfig | |
BEANSTALKD_ADDR=127.0.0.1 | |
BEANSTALKD_PORT=11300 | |
BEANSTALKD_USER=beanstalkd | |
[ -e /etc/sysconfig/beanstalkd ] && . /etc/sysconfig/beanstalkd | |
lockfile=/var/lock/subsys/beanstalkd | |
start() { | |
[ -x $exec ] || exit 5 | |
echo -n $"Starting $prog: " | |
# if not running, start it up here, usually something like "daemon $exec" | |
options="-l ${BEANSTALKD_ADDR} -p ${BEANSTALKD_PORT}" | |
if [ "${BEANSTALKD_MAX_JOB_SIZE}" != "" ]; then | |
options="${options} -z ${BEANSTALKD_MAX_JOB_SIZE}" | |
fi | |
if [ "${BEANSTALKD_BINLOG_DIR}" != "" ]; then | |
if [ ! -d "${BEANSTALKD_BINLOG_DIR}" ]; then | |
echo "Creating binlog directory (${BEANSTALKD_BINLOG_DIR})" | |
mkdir -p ${BEANSTALKD_BINLOG_DIR} && chown ${BEANSTALKD_USER}:${BEANSTALKD_USER} ${BEANSTALKD_BINLOG_DIR} | |
fi | |
options="${options} -b ${BEANSTALKD_BINLOG_DIR}" | |
if [ "${BEANSTALKD_BINLOG_FSYNC_PERIOD}" != "" ]; then | |
options="${options} -f ${BEANSTALKD_BINLOG_FSYNC_PERIOD}" | |
else | |
options="${options} -F" | |
fi | |
if [ "${BEANSTALKD_BINLOG_SIZE}" != "" ]; then | |
options="${options} -s ${BEANSTALKD_BINLOG_SIZE}" | |
fi | |
fi | |
daemon /usr/sbin/daemonize -u ${BEANSTALKD_USER} $exec $options | |
retval=$? | |
echo | |
[ $retval -eq 0 ] && touch $lockfile | |
return $retval | |
} | |
stop() { | |
echo -n $"Stopping $prog: " | |
# stop it here, often "killproc $prog" | |
killproc $prog -INT | |
retval=$? | |
echo | |
[ $retval -eq 0 ] && rm -f $lockfile | |
return $retval | |
} | |
restart() { | |
stop | |
start | |
} | |
reload() { | |
restart | |
} | |
force_reload() { | |
restart | |
} | |
rh_status() { | |
# run checks to determine if the service is running or use generic status | |
status $prog | |
} | |
rh_status_q() { | |
rh_status >/dev/null 2>&1 | |
} | |
case "$1" in | |
start) | |
rh_status_q && exit 0 | |
$1 | |
;; | |
stop) | |
rh_status_q || exit 0 | |
$1 | |
;; | |
restart) | |
$1 | |
;; | |
reload) | |
rh_status_q || exit 7 | |
$1 | |
;; | |
force-reload) | |
force_reload | |
;; | |
status) | |
rh_status | |
;; | |
condrestart|try-restart) | |
rh_status_q || exit 0 | |
restart | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" | |
exit 2 | |
esac | |
exit $? |
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
;upervisor config file | |
[unix_http_server] | |
file=/var/run/supervisor.sock ; (the path to the socket file) | |
chmod=0700 ; socket file mode (default 0700) | |
[supervisord] | |
logfile=/etc/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log) | |
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid) | |
childlogdir=/etc/supervisor | |
; the below section must remain in the config file for RPC | |
; (supervisorctl/web interface) to work, additional interfaces may be | |
; added by defining them in separate rpcinterface: sections | |
[rpcinterface:supervisor] | |
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | |
[supervisorctl] | |
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket | |
; The [include] section can just contain the "files" setting. This | |
; setting can list multiple files (separated by whitespace or | |
; newlines). It can also contain wildcards. The filenames are | |
; interpreted as relative to this file. Included files *cannot* | |
; include files themselves. | |
[include] | |
files = /etc/supervisor/conf.d/*.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment