Process time-to-live setting


 
Thread Tools Search this Thread
Operating Systems Linux Process time-to-live setting
# 1  
Old 09-30-2008
Process time-to-live setting

I have a cron job scheduled to run every 5 mins, and run a php script.
Something was not right about the script and when I checked the server had very little spare memory.
Looked in running processes and I could see that many instances of the script were still running.
I am new to this whole linux admin thing, and I am using webmin. I have a few questions.
For each instance of this script there are three lines:

15339 root 15:36 CROND 15340 root 15:36 php /var/www/html/beta/assets_30.php 15344 smmsp 15:36 /usr/sbin/sendmail -FCronDaemon -i -odi -oem -oi -t
First, is there a diference between 'kill' and 'terminate' ?
How can I kill/term all three at once, since they are obviosly related? I am currently killing only the php script, (ok after getting rid of all the php entries all the sendmail ones dissapeared. ).
Why is there a sendmail process associated with the cron job (this job has nothing to do with sending mail)

Is there a way I can set a time-to-live on each script so that linux can kill the processes automatically in case they stall.
# 2  
Old 10-09-2008
The Bulletin board munged your question. Could you repost the cron line please? When posting, click on "Go Advanced" and under Additional Options, uncheck "Automatically parse links in text" and also wrap it in "code" tags.

A few comments:
  • sendmail -t should terminate when the parent is terminated.
  • You can set a "timeout" but its based on cpu usage, not wall-clock time. See "ulimit -a".
  • Inside a PHP script you can call pcntl_alarm(30); to end the script after 30 seconds. (For more on what you can do with this, see PHP - Alarm functions - LXF Wiki .)
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to process only new line of tail -f command from live log file?

Hi, I want to read a live log file line by line and considering those line which are newly added to file Below code I am using, which read line but as soon as it read new line from log file its starts processing from very first line of file. tail -F /logs/COMMON-ERROR.log | while read... (11 Replies)
Discussion started by: ketanraut
11 Replies

2. Red Hat

Setting Up live FTP Server with Static IP in Red-Hat Linux 6

Hi Guys, I want to some guidance from you in setting up the Live FTP server in Redhat Linux 6 with Static IP 120.50.150.50. Now should I set my Static Public IP directly to my Linux machine? If so what whould be my sunbet mask? Is any type of natting required here? if so where would... (2 Replies)
Discussion started by: manalisharmabe
2 Replies

3. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

Hello All, I have a problem calculating the time difference between start and end timings...! the timings are given by 24hr format.. Start Date : 08/05/10 12:55 End Date : 08/09/10 06:50 above values are in mm/dd/yy hh:mm format. Now the thing is, 7th(08/07/10) and... (16 Replies)
Discussion started by: smarty86
16 Replies

4. UNIX for Dummies Questions & Answers

Live/real-time text-file updates in terminal

I want to have a terminal open and have something like a "repeating cat" command running in it for a certain text file (in particular /var/log/system.log). So my terminal will scan or cat the text file every so often or whenever the text file system.log gets written to by the system, it will... (1 Reply)
Discussion started by: guitarscn
1 Replies

5. Web Development

Setting up Development and Live web site environment

Hi, I am fairly new to unix so please go easy on me.. I have a VPS on which I would like to setup a development and live web site environment and can't seem to work out what is the best technique for doing so. I would like to be able to mirror the live site and have a "check out" and... (0 Replies)
Discussion started by: ciantrius
0 Replies

6. Linux

Process start time not showing correct time

Process start time is not showing the correct time: I had started a process on Jun 17th at 23:30:00. Next day morning when I run the command "ps -ef | grep mq", the process is showing the start date of Jun 17th but the start time is 00:16:41 Day/Date is setup correctly on the server. It... (2 Replies)
Discussion started by: hemangjani
2 Replies

7. UNIX for Dummies Questions & Answers

how to Decrease priority of a particular process in time of process creation

how to decrease priority of a particular process in time of process creation... and also how to decrease priority of a particular process after process creation.. can any one please help me out... (2 Replies)
Discussion started by: Ramkum
2 Replies

8. Cybersecurity

time to live

i wondering about the ttl for the sshd on solaris 9 ... i read that you can change it to a different value to fool some OS "fingerprinting" tools such as queso or nmap. the default value is 255, i've tried to set it to 155 and 55 but nmap still see that port 22 is opend. do you know something about... (3 Replies)
Discussion started by: pressy
3 Replies
Login or Register to Ask a Question