We tried restarting apache earlier today, and our semaphores were all locked up. So I ran the following command:
Code:
for i in 'ipcs -s | grep nobody | awk '{print $2}'` do ipcrm sem $i done
That didn't seem to do anything... just returned > every time I hit enter. I had to ctl-c to get back to the prompt.
Then I ran the script that our server support has run in the past when semaphores locked up:
Code:
ipcs -s | grep nobody | perl -e 'while () { @a=split(/\s+/); print `ipcrm sem $a[1]`}'
and I got the following for every loop:
Code:
deprecated usage: ipcrm {shm | msg | sem} id ...
usage: ipcrm [ [-q msqid] [-m shmid] [-s semid]
[-Q msgkey] [-M shmkey] [-S semkey] ... ]
Edit: I should clarify that I let this go on for some time, but it kept giving me this error message, so I finally ctl-c'd it to stop the process. Maybe it did work, and I just was impatient? See below...
So I have a few questions...
1) Is it safe to run ipcrm while apache is running?
2) Why is my hosting support using a deprecated script, and why did that seem to work anyway (although when I run ipcs -s | grep nobody, it seems that a ton of semaphores exist)?
In the past, we have always called our hosting company for support when this issue has arisen. But I feel more comfortable, I think, than the others in the office to do more and more of our server admin stuff. Since I've been here (for about 6 months now), I've started researching things that we can do on our own.
Anyway, in the past when they run the script above, I will run
Code:
ipcs -s | grep nobody
to see the difference, and after they clear the semaphores, very few are listed.
Today, after running both scripts above, I run ipcs -s | grep nobody, and I still see quite a few semaphores. Perhaps I didn't give the first script long enough to run, and that some of the semaphores were deleted, and that script is actually the one that fixed things?
Any ideas, comments, or solutions?
Thanks,
David