Created
February 3, 2014 11:28
-
-
Save iGhost/8782348 to your computer and use it in GitHub Desktop.
Revisions
-
iGhost created this gist
Feb 3, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ #!/bin/bash lockfile=/tmp/fastcgi_locked start() { for user in `ls /var/cpanel/users`; do if [ -e /home/${user}/public_html/php-fcgi.sock ]; then echo "Socket exist, exiting!" exit 0 fi /usr/bin/spawn-fcgi -u ${user} -g ${user} -s /home/${user}/public_html/php-fcgi.sock -S -M 0600 -C 16 -F 1 -P /var/run/fcgi-${user}.pid -f "/usr/bin/php-cgi -c /home/${user}/${user}.ini" -U nobody -G nobody done rm -f $lockfile } stop() { killall -TERM php-cgi && echo "Killed!" touch $lockfile } check() { if [ -e $lockfile ]; then echo "Lockfile found, exiting!" fi for user in `ls /var/cpanel/users`; do proc=`ps aux | grep php-cgi | grep ${user}` if [ ! "${proc}" ]; then echo "Oops!" /usr/bin/spawn-fcgi -u ${user} -g ${user} -s /home/${user}/public_html/php-fcgi.sock -S -M 0600 -C 16 -F 1 -P /var/run/fcgi-${user}.pid -f "/usr/bin/php-cgi -c /home/${user}/${user}.ini" -U nobody -G nobody else echo "It's alive!" fi done } case "$1" in start) $1 ;; stop) $1 ;; restart) stop start ;; check) $1 ;; *) echo $"Usage: $0 {start|stop|check|restart}" exit 2 esac exit $?