Commit ab1dcbc3 authored by Xavier Guimard's avatar Xavier Guimard

Fix FastCGI socket and pid path (#583)

parent 231c2d07
......@@ -110,6 +110,10 @@ RCAPTCHADIR=$(DESTDIR)/$(CAPTCHADIR)
# Apache user/group
APACHEUSER=
APACHEGROUP=
# FastCGI
FASTCGISOCKDIR=$(PREFIX)/run
RFASTCGISOCKDIR=$(DESTDIR)/$(FASTCGISOCKDIR)
FASTCGIUSER=$(APACHEUSER)
FASTCGIGROUP=$(APACHEGROUP)
......@@ -447,12 +451,14 @@ install_bin: install_conf_dir
@chmod +x $(RBINDIR)/*
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/rc/llng-fastcgi-server $(RINITDIR)
@cp -f fastcgi-server/default/llng-fastcgi-server $(RETCDEFAULTDIR)
$(PERL) -pi -e 's#__SBINDIR__#$(SBINDIR)#;s#__DEFAULTDIR__#$(ETCDEFAULTDIR)#' \
$(RETCDEFAULTDIR)/llng-fastcgi-server
@$(PERL) -pi -e 's#__SBINDIR__#$(SBINDIR)#;s#__DEFAULTDIR__#$(ETCDEFAULTDIR)#;s#__FASTCGISOCKDIR__#$(FASTCGISOCKDIR)#g' \
$(RETCDEFAULTDIR)/llng-fastcgi-server \
$(RSBINDIR)/llng-fastcgi-server \
$(RSBINDIR)/llng-fastcgi-server
@if [ ! "$(FASTCGIUSER)" ]; then \
$(PERL) -pi -e 's#__USER__#nobody#' $(RETCDEFAULTDIR)/llng-fastcgi-server; \
else \
......@@ -463,6 +469,15 @@ install_fastcgi_server:
else \
$(PERL) -pi -e 's#__USER__#$(FASTCGIGROUP)#' $(RETCDEFAULTDIR)/llng-fastcgi-server; \
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
......@@ -619,9 +634,12 @@ install_test_site:
install_examples_site:
# Examples install
@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; \
done
@for i in manager; do \
cp -a -f lemonldap-ng-$$i/eg $(REXAMPLESDIR)/$$i; \
done
@rm -rf $(REXAMPLESDIR)/portal/skins \
$(REXAMPLESDIR)/manager/skins \
@rm -rf $$(find $(REXAMPLESDIR) -type d -name .svn)
......
# Number of process (default: 7)
#NPROC = 7
# Portal CGI path
#PORTAL_PATH = /var/lib/lemonldap-ng/portal
# Unix socket to listen to
#SOCKET = /run/llng-fastcgi.sock
#SOCKET = __FASTCGISOCKDIR__/llng-fastcgi.sock
# Pid file
#PID = /run/llng-fastcgi.pid
#PID = __FASTCGISOCKDIR__/llng-fastcgi-server.pid
# User and GROUP
USER = __USER__
......
......@@ -133,7 +133,7 @@
.\" ========================================================================
.\"
.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
.\" way too many mistakes in technical documents.
.if n .ad l
......
......@@ -29,10 +29,10 @@ test -x $DAEMON || exit 0
# Try to extract llng-fastcgi-server pidfile
if [ -z "$PID" ]; then
PID=/run/llng-fastcgi-server.pid
PID=__FASTCGISOCKDIR__/llng-fastcgi-server.pid
fi
if [ -z "$SOCKET" ]; then
SOCKET=/var/run/llng-fastcgi-server/llng-fastcgi.sock
SOCKET=__FASTCGISOCKDIR__/llng-fastcgi.sock
fi
DAEMON_OPTS="-p ${PID} -u ${USER} -g ${GROUP} -s ${SOCKET}"
......
......@@ -12,9 +12,9 @@ my %_apps;
getopts( 'n:p:s:u:g:', \%opts );
$opts{n} ||= $ENV{NPROC} || 7;
$opts{p} ||= $ENV{PID} || '/run/llng-fastcgi.pid';
$opts{s} ||= $ENV{SOCKET} || '/run/llng-fastcgi.sock';
$opts{n} ||= $ENV{NPROC} || 7;
$opts{p} ||= $ENV{PID} || '__FASTCGISOCKDIR__/llng-fastcgi.pid';
$opts{s} ||= $ENV{SOCKET} || '__FASTCGISOCKDIR__/llng-fastcgi.sock';
$opts{u} ||= $ENV{USER};
$opts{g} ||= $ENV{GROUP};
......
......@@ -10,5 +10,5 @@ pre-start script
[ -x /usr/sbin/llng-fastcgi-server ] || { stop; exit 0; }
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
[Service]
Type=forking
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
ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile ${PID}
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