I am running a cron on every two minutes. From the cron I am running other shell scripts in background with "&". After cron exits spawned shell script process still runs, this is desired behavior. But does it lead to any zombi process when child script exits. Do I need to conside any special cases?
it probably will (I should check to be sure) but in any case you can store the PIDs of the forked processes and kill them on exit:
since you said "other shells" I would assume there's a few so we should use an array:
then you kill them like this on exit:
[bonus] if you wrap the previous on a function you can set a
0 is a special signal that means "on exit"