• Home
  • Help
  • Search
  • Login
  • Register
Pages: [1]
Author Topic: Starting long processes from CRON  (Read 1922 times)
CarlMLE
Newbie
*

Karma: 0
Posts: 10


View Profile WWW
« on: March 12, 2010, 06:26:11 AM »

Hi,

I need to execute a long processes from cron, currently I get cron to execute a bash script using the & operator to run it as a background process, from this bash script I execute my application again using the & to background the process, but when I look at the ps list I see [sh] <defunct>, [cron] <defunct>. as if cron is waiting around for my application to end?

should I be worried about defunct processes? is there a better way to get cron to kick of an application and not wait for it to end?

Thanks in advance.
Logged

ML Electronics - www.ml-electronics.co.uk

pingtoo
Sr. Member
****

Karma: 15
Posts: 318


View Profile
« Reply #1 on: March 12, 2010, 06:51:46 AM »

Hi,

I need to execute a long processes from cron, currently I get cron to execute a bash script using the & operator to run it as a background process, from this bash script I execute my application again using the & to background the process, but when I look at the ps list I see [sh] <defunct>, [cron] <defunct>. as if cron is waiting around for my application to end?

should I be worried about defunct processes? is there a better way to get cron to kick of an application and not wait for it to end?

Thanks in advance.
In shell script you can use exec command to replace the running shell process with your program. A example
Code:
#/bin/sh

exec /usr/bin/sleep 30&
You can try ps, you will not see the defunct process.
Logged

Good Luck Smiley

CarlMLE
Newbie
*

Karma: 0
Posts: 10


View Profile WWW
« Reply #2 on: March 15, 2010, 03:42:41 AM »

Thanks for your reply Smiley
Logged

ML Electronics - www.ml-electronics.co.uk

Pages: [1]
Print
Jump to: