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
exec /usr/bin/sleep 30&
You can try ps
, you will not see the defunct process.