File: php-fpm-socket-helper

package info (click to toggle)
php-defaults 76
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 244 kB
  • sloc: sh: 858; makefile: 70
file content (25 lines) | stat: -rwxr-xr-x 514 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh

DEFAULT_SOCKET="${2}"
POOL_FILE="${3}"
PRIORITY="${4}"

[ -r "${POOL_FILE}" ] || exit 0

SOCKET=$(sed -n 's/^listen[[:space:]]*=[[:space:]]*\([^[:space:]]*\)/\1/p' "${POOL_FILE}")

[ -S "${SOCKET}" ] || exit 0

case "$1" in
    start|install)
	/usr/bin/update-alternatives --quiet --install "${DEFAULT_SOCKET}" php-fpm.sock "${SOCKET}" "${PRIORITY}" 2>/dev/null
	;;
    stop|remove)
	/usr/bin/update-alternatives --quiet --remove php-fpm.sock "${SOCKET}" 2>/dev/null
	;;
    *)
	exit 1
	;;
esac

exit 0