first thank you both for the responses.
@kbp: you are correct there was nothing wrong with that line. I appeared to have fat-fingered the sudoers file.
@anomie:
Sure, I'll go into further detail.
my company is using a multi-threaded PHP Daemon
( project page if you're interested
http://code.google.com/p/phpmultithreadeddaemon/ ) to monitor a directory and parse files.
There are certain times when we get more files than usual. So, I was asked to create a general web interface where anyone from within the server team could go in and increase/decrease the number of processes being spawned.
after the person changes the number of threads, and clicks the save button, the Daemon needs to be notified of the changes, which is only possible via a SIGHUP (the multi-threaded daemon application is already coded to handle SIGHUPs).
I must say, however, creating a script and giving Apache permission to only run that script is a much preferred way instead of giving Apache the kill command.
when the daemon starts, it writes its process ID to /var/run/pmtd.pid so I think instead of using pkill I'd just cat the PID from the file written to at start up.
PHP Code:
!#/bin/sh
# Get the PID from the file written to at start-up
/bin/kill -s SIGHUP `cat /var/run/pmtd.pid`
exit 0;
I greatly appreciate the help. And thank you for explaining in detail what you were doing each step.
I have been using Linux for years now and I must say, I learn something new every day.
I noticed you ended the script with exit 0; why is that? Does that have an added benefit as opposed to just letting the script run the kill command?
if you have any other questions, please feel free to ask.