Blame SOURCES/docker-registry.sysvinit

da6803
#!/bin/sh
da6803
#
da6803
#       /etc/rc.d/init.d/docker-registry
da6803
#
da6803
#       Registry server for Docker
da6803
#       
da6803
# chkconfig:   2345 93 93
da6803
# description: Registry server for Docker
da6803
da6803
### BEGIN INIT INFO
da6803
# Provides:       docker-registry
da6803
# Required-Start: $network
da6803
# Required-Stop:
da6803
# Should-Start:
da6803
# Should-Stop:
da6803
# Default-Start: 2 3 4 5
da6803
# Default-Stop:  0 1 6
da6803
# Short-Description: start and stop Docker registry
da6803
# Description: Registry server for Docker
da6803
### END INIT INFO
da6803
da6803
# Source function library.
da6803
. /etc/rc.d/init.d/functions
da6803
da6803
exec="/usr/bin/python"
da6803
prog="docker-registry"
da6803
pidfile="/var/run/$prog.pid"
da6803
lockfile="/var/lock/subsys/$prog"
da6803
logfile="/var/log/$prog"
da6803
da6803
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
da6803
da6803
export DOCKER_REGISTRY_CONFIG=${DOCKER_REGISTRY_CONFIG:-"/etc/docker-registry.yml"}
da6803
export SETTINGS_FLAVOR=${SETTINGS_FLAVOR:-"dev"}
da6803
da6803
start() {
da6803
    [ -x $exec ] || exit 5
da6803
da6803
    if ! [ -f $pidfile ]; then
da6803
        cd #WORKDIR#
da6803
        printf "Starting $prog:\t"
da6803
        $exec /usr/bin/gunicorn --access-logfile - --debug --max-requests 100 --graceful-timeout 3600 -t 3600 -k gevent -b ${REGISTRY_ADDRESS}:${REGISTRY_PORT} -w $GUNICORN_WORKERS wsgi:application &>> $logfile &
da6803
        pid=$!
da6803
        echo $pid > $pidfile
da6803
        touch $lockfile
da6803
        success
da6803
        echo
da6803
    else
da6803
        failure
da6803
        echo
da6803
        printf "$pidfile still exists...\n"
da6803
        exit 7
da6803
    fi
da6803
}
da6803
da6803
stop() {
da6803
    echo -n $"Stopping $prog: "
da6803
    killproc -p $pidfile $prog
da6803
    retval=$?
da6803
    echo
da6803
    [ $retval -eq 0 ] && rm -f $lockfile
da6803
    return $retval
da6803
}
da6803
da6803
restart() {
da6803
    stop
da6803
    start
da6803
}
da6803
da6803
reload() {
da6803
    restart
da6803
}
da6803
da6803
force_reload() {
da6803
    restart
da6803
}
da6803
da6803
rh_status() {
da6803
    status -p $pidfile $prog
da6803
}
da6803
da6803
rh_status_q() {
da6803
    rh_status >/dev/null 2>&1
da6803
}
da6803
da6803
case "$1" in
da6803
    start)
da6803
        rh_status_q && exit 0
da6803
        $1
da6803
        ;;
da6803
    stop)
da6803
        rh_status_q || exit 0
da6803
        $1
da6803
        ;;
da6803
    restart)
da6803
        $1
da6803
        ;;
da6803
    reload)
da6803
        rh_status_q || exit 7
da6803
        $1
da6803
        ;;
da6803
    force-reload)
da6803
        force_reload
da6803
        ;;
da6803
    status)
da6803
        rh_status
da6803
        ;;
da6803
    condrestart|try-restart)
da6803
        rh_status_q || exit 0
da6803
        restart
da6803
        ;;
da6803
    *)
da6803
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
da6803
        exit 2
da6803
esac
da6803
da6803
exit $?