Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

What is the solution if somebody deletes /var/lock/subsys/httpd file.

share|improve this question
add comment

1 Answer

Generally, you can ask any process to terminate gracefully by finding its PID, and sending it signal 15. Try

www% ps auxww|grep http
apache     311  0.0  0.5  42932 22580 ?        S    Mar11   0:21 /usr/sbin/httpd
apache    2547  0.0  0.5  42768 22188 ?        S    Mar12   0:06 /usr/sbin/httpd
root      2669  0.0  0.2  28500 11228 ?        Ss   Feb15   0:00 /usr/sbin/httpd
[ and many more http processes ] 

The one you're interested in is the parent, which is the one owned by root. It's PID is the second column, in this case 2669, so ask it to die with

% kill -15 2669

Repeat the ps command to make sure it's gone. If it won't go gracefully, you can force it to die with signal 9:

% kill -9 2669

There are other commands on some UNIXes to kill specific groups of processes, or all processes with a particular chunk of text in the name, but you don't say which OS you're using (though the use of a /var/lock file makes it clear it's some kind of UNIX). Try man killall and you may well find out whether killall httpd would be simpler for you.

Generally, you will need to be root, or use the sudo command, in order to send an arbitrary signal to an arbitrary process.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.