Jump to content

Can I Cron This? [Solved]


Guest MDMAchine
 Share

Recommended Posts

Guest MDMAchine

Hello all,

 

I guess this thread here would best suit what I need to ask, and I have tried to search but didn’t see anything about this.

 

Anyways... I run a process which is for statistical generation. Anywhere from 2-12 hours the process remains but stops working. I don’t think it has to do with high CPU load or anything like that. I believe it has a bug, so it’s running, but not working right anymore.

 

Now I had made a cron job set for every 1 hour in hopes that it would "restart" the process, but I guess if it’s running it does not kill it.

 

The cron job is as follows:

0 * * * * cd /command/directory; ./pearlscript.pl

 

So now if I go in and kill this process by hand when it starts up again it has a new PID. So I can’t set a cron to kill this PID every 58 mins to then get restarted... Or can I?

I would need "static" information to have it set like that I would assume?

 

Any help on this situation would be appreciated! Remembering to kill this process every 2 hours is annoying. :angry:

 

BTW - These forums are great I have used them for resources for over a year, and until now has answered all of my questions!

Sorry if there is something about this that I missed....

 

MD

Edited by MDMAchine
Link to comment
Share on other sites

you could get it to write its pid out to a file when it started and kill that, or you could be lazy. I'm assuming it always has the same process name and that name is unique. If so, you can just use killall:

 

killall foo

 

kills all processes named foo, no matter what their PID.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...