Commit ab1dcbc3 authored by Yadd's avatar Yadd

Fix FastCGI socket and pid path (#583)

parent 231c2d07
...@@ -110,6 +110,10 @@ RCAPTCHADIR=$(DESTDIR)/$(CAPTCHADIR) ...@@ -110,6 +110,10 @@ RCAPTCHADIR=$(DESTDIR)/$(CAPTCHADIR)
# Apache user/group # Apache user/group
APACHEUSER= APACHEUSER=
APACHEGROUP= APACHEGROUP=
# FastCGI
FASTCGISOCKDIR=$(PREFIX)/run
RFASTCGISOCKDIR=$(DESTDIR)/$(FASTCGISOCKDIR)
FASTCGIUSER=$(APACHEUSER) FASTCGIUSER=$(APACHEUSER)
FASTCGIGROUP=$(APACHEGROUP) FASTCGIGROUP=$(APACHEGROUP)
...@@ -447,12 +451,14 @@ install_bin: install_conf_dir ...@@ -447,12 +451,14 @@ install_bin: install_conf_dir
@chmod +x $(RBINDIR)/* @chmod +x $(RBINDIR)/*
install_fastcgi_server: install_fastcgi_server:
@install -v -d $(RSBINDIR) $(RINITDIR) $(RETCDEFAULTDIR) @install -v -d $(RSBINDIR) $(RINITDIR) $(RETCDEFAULTDIR) $(RFASTCGISOCKDIR)
@cp -f fastcgi-server/sbin/llng-fastcgi-server $(RSBINDIR) @cp -f fastcgi-server/sbin/llng-fastcgi-server $(RSBINDIR)
@cp -f fastcgi-server/rc/llng-fastcgi-server $(RINITDIR) @cp -f fastcgi-server/rc/llng-fastcgi-server $(RINITDIR)
@cp -f fastcgi-server/default/llng-fastcgi-server $(RETCDEFAULTDIR) @cp -f fastcgi-server/default/llng-fastcgi-server $(RETCDEFAULTDIR)
$(PERL) -pi -e 's#__SBINDIR__#$(SBINDIR)#;s#__DEFAULTDIR__#$(ETCDEFAULTDIR)#' \ @$(PERL) -pi -e 's#__SBINDIR__#$(SBINDIR)#;s#__DEFAULTDIR__#$(ETCDEFAULTDIR)#;s#__FASTCGISOCKDIR__#$(FASTCGISOCKDIR)#g' \
$(RETCDEFAULTDIR)/llng-fastcgi-server $(RETCDEFAULTDIR)/llng-fastcgi-server \
$(RSBINDIR)/llng-fastcgi-server \
$(RSBINDIR)/llng-fastcgi-server
@if [ ! "$(FASTCGIUSER)" ]; then \ @if [ ! "$(FASTCGIUSER)" ]; then \
$(PERL) -pi -e 's#__USER__#nobody#' $(RETCDEFAULTDIR)/llng-fastcgi-server; \ $(PERL) -pi -e 's#__USER__#nobody#' $(RETCDEFAULTDIR)/llng-fastcgi-server; \
else \ else \
...@@ -463,6 +469,15 @@ install_fastcgi_server: ...@@ -463,6 +469,15 @@ install_fastcgi_server:
else \ else \
$(PERL) -pi -e 's#__USER__#$(FASTCGIGROUP)#' $(RETCDEFAULTDIR)/llng-fastcgi-server; \ $(PERL) -pi -e 's#__USER__#$(FASTCGIGROUP)#' $(RETCDEFAULTDIR)/llng-fastcgi-server; \
fi fi
if [ "$(FASTCGIUSER)" != "" ]; then \
chown $(FASTCGIUSER) $(RFASTCGISOCKDIR) || exit 1; \
if [ "$(FASTCGIGROUP)" != "" ]; then \
chgrp $(FASTCGIGROUP) $(RFASTCGISOCKDIR) || exit 1; \
fi; \
chmod 770 $(RFASTCGISOCKDIR); \
else \
chmod 777 $(RFASTCGISOCKDIR); \
fi
# #
# SITE INSTALL # SITE INSTALL
...@@ -619,9 +634,12 @@ install_test_site: ...@@ -619,9 +634,12 @@ install_test_site:
install_examples_site: install_examples_site:
# Examples install # Examples install
@install -v -d $(REXAMPLESDIR) @install -v -d $(REXAMPLESDIR)
@for i in manager portal handler; do \ @for i in portal handler; do \
cp -a -f lemonldap-ng-$$i/example $(REXAMPLESDIR)/$$i; \ cp -a -f lemonldap-ng-$$i/example $(REXAMPLESDIR)/$$i; \
done done
@for i in manager; do \
cp -a -f lemonldap-ng-$$i/eg $(REXAMPLESDIR)/$$i; \
done
@rm -rf $(REXAMPLESDIR)/portal/skins \ @rm -rf $(REXAMPLESDIR)/portal/skins \
$(REXAMPLESDIR)/manager/skins \ $(REXAMPLESDIR)/manager/skins \
@rm -rf $$(find $(REXAMPLESDIR) -type d -name .svn) @rm -rf $$(find $(REXAMPLESDIR) -type d -name .svn)
......
# Number of process (default: 7) # Number of process (default: 7)
#NPROC = 7 #NPROC = 7
# Portal CGI path
#PORTAL_PATH = /var/lib/lemonldap-ng/portal
# Unix socket to listen to # Unix socket to listen to
#SOCKET = /run/llng-fastcgi.sock #SOCKET = __FASTCGISOCKDIR__/llng-fastcgi.sock
# Pid file # Pid file
#PID = /run/llng-fastcgi.pid #PID = __FASTCGISOCKDIR__/llng-fastcgi-server.pid
# User and GROUP # User and GROUP
USER = __USER__ USER = __USER__
......
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
.\" ======================================================================== .\" ========================================================================
.\" .\"
.IX Title "llng-fastcgi-server 1" .IX Title "llng-fastcgi-server 1"
.TH llng-fastcgi-server 1 "2016-02-11" "perl v5.22.1" "User Contributed Perl Documentation" .TH llng-fastcgi-server 1 "2016-02-15" "perl v5.22.1" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents. .\" way too many mistakes in technical documents.
.if n .ad l .if n .ad l
......
...@@ -29,10 +29,10 @@ test -x $DAEMON || exit 0 ...@@ -29,10 +29,10 @@ test -x $DAEMON || exit 0
# Try to extract llng-fastcgi-server pidfile # Try to extract llng-fastcgi-server pidfile
if [ -z "$PID" ]; then if [ -z "$PID" ]; then
PID=/run/llng-fastcgi-server.pid PID=__FASTCGISOCKDIR__/llng-fastcgi-server.pid
fi fi
if [ -z "$SOCKET" ]; then if [ -z "$SOCKET" ]; then
SOCKET=/var/run/llng-fastcgi-server/llng-fastcgi.sock SOCKET=__FASTCGISOCKDIR__/llng-fastcgi.sock
fi fi
DAEMON_OPTS="-p ${PID} -u ${USER} -g ${GROUP} -s ${SOCKET}" DAEMON_OPTS="-p ${PID} -u ${USER} -g ${GROUP} -s ${SOCKET}"
......
...@@ -12,9 +12,9 @@ my %_apps; ...@@ -12,9 +12,9 @@ my %_apps;
getopts( 'n:p:s:u:g:', \%opts ); getopts( 'n:p:s:u:g:', \%opts );
$opts{n} ||= $ENV{NPROC} || 7; $opts{n} ||= $ENV{NPROC} || 7;
$opts{p} ||= $ENV{PID} || '/run/llng-fastcgi.pid'; $opts{p} ||= $ENV{PID} || '__FASTCGISOCKDIR__/llng-fastcgi.pid';
$opts{s} ||= $ENV{SOCKET} || '/run/llng-fastcgi.sock'; $opts{s} ||= $ENV{SOCKET} || '__FASTCGISOCKDIR__/llng-fastcgi.sock';
$opts{u} ||= $ENV{USER}; $opts{u} ||= $ENV{USER};
$opts{g} ||= $ENV{GROUP}; $opts{g} ||= $ENV{GROUP};
......
...@@ -10,5 +10,5 @@ pre-start script ...@@ -10,5 +10,5 @@ pre-start script
[ -x /usr/sbin/llng-fastcgi-server ] || { stop; exit 0; } [ -x /usr/sbin/llng-fastcgi-server ] || { stop; exit 0; }
end script end script
exec /usr/sbin/llng-fastcgi-server -u www-data -g www-data -s /var/run/llng-fastcgi-server/llng-fastcgi.sock -p /var/run/llng-fastcgi-server/llng-fastcgi-server.pid exec /usr/sbin/llng-fastcgi-server -u www-data -g www-data -s __FASTCGISOCKDIR__/llng-fastcgi.sock -p __FASTCGISOCKDIR__/llng-fastcgi-server.pid
...@@ -5,7 +5,7 @@ After=network.target ...@@ -5,7 +5,7 @@ After=network.target
[Service] [Service]
Type=forking Type=forking
EnvironmentFile=/etc/default/llng-fastcgi-server EnvironmentFile=/etc/default/llng-fastcgi-server
PIDFile=/var/run/llng-fastcgi-server/llng-fastcgi-server.pid PIDFile=__FASTCGISOCKDIR__/llng-fastcgi-server.pid
ExecStart=/usr/sbin/llng-fastcgi-server ExecStart=/usr/sbin/llng-fastcgi-server
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile ${PID} ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile ${PID}
KillMode=mixed KillMode=mixed
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment