#! /bin/sh #---------------------------------------------------------------------------- # /etc/init.d/php7.3-fpm - start/stop/restart php7.3-fpm # # Creation: 2018-01-01 schlotze # Last Update: $Id: php7.3-fpm 62201 2019-01-08 16:39:08Z schlotze $ # # Copyright (c) 2018-2019 the eisfair team, team(at)eisfair(dot)org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # read functions . /etc/init.d/functions prefix=/usr exec_prefix=/usr php_fpm_BIN=${exec_prefix}/sbin/php7.3-fpm php_fpm_CONF=/etc/php7.3/php7.3-fpm.conf php_fpm_PID=/run/php7.3-fpm.pid php_opts="--fpm-config $php_fpm_CONF -c /etc/php7.3/fpm/php.ini --pid $php_fpm_PID" # Include config . /etc/config.d/php7.3-fpm # --------------------------------------------------------------------------- # usage # --------------------------------------------------------------------------- usage() { cat </dev/null wait_for_pid created $php_fpm_PID } # --------------------------------------------------------------------------- # stop fpm # --------------------------------------------------------------------------- fpm_stop() { pidofproc -p ${php_fpm_PID} -s ${php_fpm_BIN} if [ "${?}" -eq "3" -a "$(tty)" = "/dev/console" ] then _mesg=false fi if ${_mesg:-true} then boot_mesg " * Stopping php7.3-fpm ..." fi killproc -p ${php_fpm_PID} ${php_fpm_BIN} } # --------------------------------------------------------------------------- # status fpm # --------------------------------------------------------------------------- fpm_status() { statusproc ${php_fpm_BIN} } # --------------------------------------------------------------------------- # restart fpm # --------------------------------------------------------------------------- fpm_restart() { fpm_stop sleep 5 fpm_start } # --------------------------------------------------------------------------- # reload fpm # --------------------------------------------------------------------------- fpm_reload() { pidofproc -p ${php_fpm_PID} -s ${php_fpm_BIN} case ${?} in 0) fpm_reload=true ;; 1) /usr/bin/rm -f ${php_fpm_PID} ;; esac if ! ${fpm_reolad:-false} then boot_mesg " * Reload php7.3-fpm service ..." RELOADSIG="USR2" reloadproc -p ${php_fpm_PID} ${php_fpm_BIN} else fpm_start fi } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- while [ "${#}" -gt 0 ] do case "${1}" in -q|--quiet) _quiet=true shift ;; *) _action="${1}" shift ;; esac done case "${_action}" in start) fpm_start ;; stop) fpm_stop ;; status) fpm_status ;; restart) fpm_restart ;; reload) fpm_reload ;; *) usage exit 1 ;; esac exit 0 # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------