Project

General

Profile

[Solved] Failed to read PID from file /var/run/httpd.pid: Invalid argument

Added by chipmunk over 5 years ago

I've read tons of forum notes on above subject but none could resolve this problem

I have a script in /etc/init.d (storeapp) which starts up lighttpd

configfile=/usr/local/rails/storeapp/config/lighttpd.conf

# Location of the lighttpd executable
#httpd=/usr/local/sbin/lighttpd
httpd=/usr/sbin/lighttpd

prog=lighttpd
pidfile=${PIDFILE-/var/run/lighttpd.pid}
lockfile=${LOCKFILE-/var/lock/subsys/lighttpd}
OPTIONS="-f $configfile" 
RETVAL=0

start() {
        echo -n $"Starting $prog: " 
        startproc $httpd $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL = 0 ] && touch ${lockfile}
        return $RETVAL

I then entered systemctl enable storeapp, then systemctl start storeapp

I then get

● storeapp.service - SYSV: Lighttpd is a World Wide Web server.  It is used to serve HTML files and CGI.
   Loaded: loaded (/etc/init.d/storeapp; bad; vendor preset: disabled)
   Active: failed (Result: resources) since Fri 2019-01-11 12:59:22 EST; 15min ago
     Docs: man:systemd-sysv-generator(8)

Jan 11 12:59:22 mtplvw-dobpix systemd[1]: Starting SYSV: Lighttpd is a World Wide Web server.  It is used to serve HTML files and CGI....
Jan 11 12:59:22 mtplvw-dobpix storeapp[5455]: Starting lighttpd:
Jan 11 12:59:22 mtplvw-dobpix systemd[1]: storeapp.service: PID file /var/run/httpd.pid not readable (yet?) after start: No such file or directory
Jan 11 12:59:22 mtplvw-dobpix systemd[1]: storeapp.service: Daemon never wrote its PID file. Failing.
Jan 11 12:59:22 mtplvw-dobpix systemd[1]: Failed to start SYSV: Lighttpd is a World Wide Web server.  It is used to serve HTML files and CGI..
Jan 11 12:59:22 mtplvw-dobpix systemd[1]: storeapp.service: Unit entered failed state.
Jan 11 12:59:22 mtplvw-dobpix systemd[1]: storeapp.service: Failed with result 'resources'.

I do have a /var/run file system.

The systemctl enable created files in /run/systemd/....storeapp.service but here's the funny part.

PIDFile=/var/run/httpd.pid
ExecStart=/etc/init.d/storeapp start
ExecStop=/etc/init.d/storeapp stop
ExecReload=/etc/init.d/storeapp reload

why is the pid file not the same as the one in my /etc/init.d/storeapp (/var/run/lighttpd.pid) ?

Is this the reason that this is failing ?


Replies (1)

RE: Failed to read PID from file /var/run/httpd.pid: Invalid argument - Added by gstrauss over 5 years ago

Please note that your entire question is about systemd. This is a forum for lighttpd.

The mismatch is the reason it is failing.

If something is exporting PIDFILE, then that value would be preferred over the fallback in pidfile=${PIDFILE-/var/run/lighttpd.pid}

    (1-1/1)