Even through im a shitty scripter and my scripts can make people tear their eyes out, i usually make it stable and problem-free.

the funny thing was that it was actually working great, running it from the shell. but setting it up in crontab – it just didnt run the script fully.

after playing around with the script, setting it to -x and using tee i could see that the script stopped working half way – really nothing special that was about to be executed.

Checking ps aux, right after the script was executed, i saw..

root 25294 0.0 0.0 0 0 ? Z 18:05 0:00 [cron] <defunct>

after spending too much time on google, i really never found anything specific. but something in my script was fucking up cron..

after a tip from a friend (google) i did the following

root@foo:/# env |grep SHELL
SHELL=/bin/bash

and from crontab the same (just redirected the output to a file)

this showed that CRON uses “SH” and not “BASH” when running. however, this shouldnt really matter since its defined in my script (#!/bin/bash)

never the less, i tried to change my script to use SH instead of BASH, and to my surprise, it stopped the exact same place..

i guess theres a way to change cron to use bash instead of SH, but it could probably screw up more things – which i dont need right now.

so adding /bin/bash infront of the script i want to execute in cron

* * * * * /bin/bash /root/myscript.sh

seems to solve the problem.