Pid file not updated at

Issue #141 resolved
s s created an issue

Hi, When i make piler reload first time it is ok: /etc/init.d/piler reload

But second time you can see following: etc/init.d/piler reload /etc/init.d/piler: line 49: kill: (1129) - No such process

It is because cat /var/run/piler/piler.pid 1129

But it was changed. And master process died, at ps afx i can see 10 chield processes /usr/local/sbin/piler -d.

So after first reload second i can not execute: /etc/init.d/piler reload / stop

I use:

piler -v

piler 0.1.24-master-branch, build 836, Janos SUTO sj@acts.hu

Build Date: Tue Sep 10 05:20:39 EDT 2013 ldd version: ldd (GNU libc) 2.12 gcc version: gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) Configure command: ./configure --localstatedir=/var --with-database=mysql --enable-starttls --enable-tcpwrappers

Thanks for your help!

Comments (13)

  1. s s reporter

    I am use CentOS 6.4 ... i see that in vmware image (debian) it works fine

    One problem is that when i push Apply changes button i see the same message all the time, even if sudoers was modified.

    "add the following to /etc/sudoers: 'www-data all=nopasswd: /etc/init.d/rc.piler reload'"

  2. Janos SUTO repo owner

    perhaps the webserver is not run as www-data, rather as apache or similar user.

    Please show me your actual /etc/init.d/piler file as well.

  3. s s reporter

    I am not using piler 0.1.24 on CentOS anymore. I am using Debian 7 with piler 0.1.24-master-branch, build 836 piler reload work fine.

    But issue with "Apply changes" button still exist.

  4. Janos SUTO repo owner

    Well, then you have to tweak the sudo entry to allow the webserver to execute the reload command without giving a password. Btw. do you have /etc/init.d/rc.piler, and is it executable?

  5. s s reporter

    I've changed sudoers to folowing:

    www-data   ALL = NOPASSWD: /etc/init.d/rc.piler, /bin/kill
    

    It is working now.

    It is not secure to allow www-data execute kill process... Can you look and change to reload on another way?

    Thanks.

  6. Janos SUTO repo owner

    I'm glad it's working now, but I'm not sure why you need the kill command since you don't use it directly, just the rc.piler shell script (which invokes the kill command).

    Just asking, perhaps you tried without the kill command, and didn't work that way, right?

  7. s s reporter

    It is inside of rc.piler

    # grep -n kill /etc/init.d/rc.piler 
    16:     kill ${PID_NUMBER}
    48:             kill -HUP $PID_NUMBER
    
  8. Janos SUTO repo owner

    I know that it's in rc.piler I just don't understand why you have to add it to the sudoers file. Can you try whether it works by removing the kill command from sudoers?

  9. s s reporter

    In this case it does not allow to execute reload from user www-data I did test when made su www-data and sudo /etc/init.d/rc.piler reload Also message "Applied" not displayed.

  10. Janos SUTO repo owner

    Ok, I see, thanks for the clarification. I agree it's unpleasant to give the kill command to user www-data. Perhaps I'll write a binary pilerctl (like "postfix") to support start, stop and reload operations.

  11. Janos SUTO repo owner

    So, it's finally ready. I dropped the postfix-like utility, rather I created a short utility, see contrib/reload which does this very thing: send a HUP signal to the PID found in the pidfile. So download the latest master branch, and copy the contrib/reload/pilerreload utility to /usr/local/bin. I'm still not sure whether it's worth to make it setuid to user piler or not and better to enable it in the sudoers file.

    Also update the webui directory, and set in config-site.php:

    $config['RELOAD_COMMAND'] = '/usr/local/bin/pilerreload';

  12. Log in to comment