Created
August 4, 2014 06:07
-
-
Save jonathanmtran/09a7f30c4d9073eec539 to your computer and use it in GitHub Desktop.
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 | |
### BEGIN INIT INFO | |
# Provides: php-fpm-acl | |
# Required-Start: $local_fs | |
# Required-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Sets the necessary ACLs on /var/run/php-fpm | |
# Description: Sets the necessary ACLs on /var/run/php-fpm | |
### END INIT INFO | |
PATH=/sbin:/usr/sbin:/bin:/usr/bin | |
SCRIPTNAME=php-fpm-acl | |
PHP_FPM_DIR=/var/run/php-fpm | |
# Load the VERBOSE setting and other rcS variables | |
. /lib/init/vars.sh | |
# Define LSB log_* functions. | |
# Depend on lsb-base (>= 3.2-14) to ensure that this file is present | |
# and status_of_proc is working. | |
. /lib/lsb/init-functions | |
case "$1" in | |
start) | |
MESSAGE="Setting ACLs on $PHP_FPM_DIR" | |
if [ ! -d $PHP_FPM_DIR ]; then | |
mkdir $PHP_FPM_DIR | |
fi | |
chown daemon:daemon $PHP_FPM_DIR | |
setfacl -m group:sudo:rwX $PHP_FPM_DIR | |
setfacl -dm user:daemon:rw,group:daemon:rw $PHP_FPM_DIR | |
setfacl -m other::--- $PHP_FPM_DIR | |
setfacl -dm other::--- $PHP_FPM_DIR | |
log_success_msg $MESSAGE | |
exit 0 | |
;; | |
stop) | |
;; | |
*) | |
echo "Usage: $SCRIPTNAME {start}" >&2 | |
exit 3 | |
;; | |
esac | |
: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment