[Linux] script doesn't work correctly in cron

Domain/Linux 2009.10.13 19:49

[[ blog 이사 과정에서 정확한 posting날짜가 분실됨. 년도와 분기 정도는 맞지 않을까? ]]

Sometimes, script that works well in command shell, doesn't work correctly in 'cron'.
In this case, following should be checked firstly.

'cron' uses initial environment varialbe. And in this case, '/bin/sh' is used as a shell.
In case of some high-version-ubuntu, '/bin/sh' is not 'bash' but 'dash'. And this can be root cause of this issue.
To avoid this, we should always add "#!/bin/bash" at the top of bash script, habitually.

tags : ,
Trackback 0 : Comment 0

티스토리 툴바