Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Puppet init script doesn't create the pid file?

  • CentOS release 5.4 (Final)
  • puppet-server-2.7.19-1.el5 is installed from the puppetlabs repo.

puppetmaster is started successfull, but it doesn't create the pid file. It is the reason for [ FAILED ] message when stopping:

/etc/init.d/puppetmaster stop
Stopping puppetmaster:                                     [FAILED]

The init script: http://fpaste.org/nsfI/

The /etc/rc.d/init.d/functions library: http://fpaste.org/ox5Q/

And this is what I get when running in the debug mode: http://fpaste.org/DkoS/

I know the way to echo the pid to a file manually after starting, but why doesn't daemon function's --pidfile work?

daemon $PUPPETMASTER $PUPPETMASTER_OPTS --masterport=${PUPPETMASTER_PORTS[$i]} --pidfile=/var/run/puppet/puppetmaster.${PUPPETMASTER_PORTS[$i]}.pid

Sure, Puppet master is running as puppet user:

ps -ef | grep [p]uppet
puppet   23418     1  0 18:13 ?        00:00:00 /usr/bin/ruby /usr/sbin/puppetmasterd

and the owner of /var/run/puppet/ folder is puppet:

# ls -ld /var/run/puppet/
drwxr-xr-x 2 puppet puppet 4096 Sep 17 18:46 /var/run/puppet/
like image 656
quanta Avatar asked Nov 03 '22 14:11

quanta


1 Answers

It is up to the controlled program (in this case puppetmasterd), not the daemon() function, to create the pidfile; daemon() relies on this.

Confirm where puppetmasterd creates its pidfile (it could be /var/run/puppet.pid, /var/lib/puppet/run/master.pid, etc.) To find out, inspect the contents of puppetmasterd (if a script), or kill puppetmasterd then strace -f puppetmasterd 2>&1 | grep '\.pid'.

Modify the value of pidfile in your /etc/init.d/puppetmaster accordingly.

like image 181
vladr Avatar answered Nov 08 '22 06:11

vladr