parser

Написать ответ на текущее сообщение

 

 
   команды управления поиском

Ответ (Debian 11 + spawn-fcgi) !! криво !!

AK666 06.09.2022 05:45 / 06.09.2022 05:52

/usr/bin/spawn-fcgi-start
#!/bin/bash

#
#  /lib/systemd/system
#   spawn-fcgi.service
#   spawn-fcgi.socket
#
# systemctl daemon-reload
#

set -e

if [ "${LISTEN_PID}" != $$ ]; then
    echo >&2 "file descriptors not for us, pid not matching: '${LISTEN_PID}' != '$$'"
    exit 255
fi

if [ "${LISTEN_FDS}" != "1" ]; then
    echo >&2 "Requires exactly one socket passed to fastcgi, got: '${LISTEN_FDS:-0}'"
    exit 255
fi

unset LISTEN_FDS

# move socket from 3 to 0
exec 0<&3
exec 3<&-

# spawn fastcgi backend
##exec "$@"
exec /usr/bin/spawn-fcgi -u www-data -g www-data -s /run/spawn-fcgi/socket -S -M 0700 -C 32 -F 1 -P /run/spawn-fcgi/pid -- /usr/bin/multiwatch -f 32 /usr/sbin/fcgiwrap
/usr/bin/spawn-fcgi-stop
#!/bin/sh

PID=/run/spawn-fcgi/pid

if [ -f $PID ] ; then
    kill -QUIT `cat $PID`
    rm -f $PID
else
    exit 0
fi
/lib/systemd/system/spawn-fcgi.service
[Unit]
Description=SPAWN CGI Server
After=nss-user-lookup.target
Requires=spawn-fcgi.socket

[Service]
#Type=simple
Type=forking
User=www-data
Group=www-data
StandardOutput=null
StandardError=syslog
#ExecStart=/usr/bin/spawn-fcgi-systemd /etc/init.d/spawn-fcgi start
#ExecStop=/usr/bin/spawn-fcgi-systemd /etc/init.d/spawn-fcgi stop
ExecStart=/usr/bin/spawn-fcgi-start
ExecStop=/usr/bin/spawn-fcgi-stop


[Install]
Also=spawn-fcgi.socket
WantedBy=multi-user.target
/lib/systemd/system/spawn-fcgi.socket
[Unit]
Description=spawn-fcgi Socket

[Socket]
SocketUser=www-data
SocketGroup=www-data
SocketMode=0600
ListenStream=/run/fcgiwrap.socket

[Install]
WantedBy=sockets.target
-----

# systemctl daemon-reload
# systemctl enable spawn-fcgi
# systemctl start spawn-fcgi
# systemctl status spawn-fcgi
● spawn-fcgi.service - SPAWN CGI Server
   Loaded: loaded (/lib/systemd/system/spawn-fcgi.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2022-09-05 05:35:19 UTC; 21h ago
 Main PID: 10692 (multiwatch)
    Tasks: 33 (limit: 2359)
   Memory: 14.7M
   CGroup: /system.slice/spawn-fcgi.service
           ├─10692 /usr/bin/multiwatch -f 32 /usr/sbin/fcgiwrap
           ├─10693 /usr/sbin/fcgiwrap
          ...
           ├─10722 /usr/sbin/fcgiwrap
           ├─10723 /usr/sbin/fcgiwrap
           └─10724 /usr/sbin/fcgiwrap