Exec format error (in cron)
If you are like me, you sometimes get lazy
and forget to include the shell command at the top of your scripts. This usually isn't a problem, but in certain cases (where
the shell isn't set, or doesn't exist yet) it will cause problems. So, even if your script is set to be executable (chmod +x
), you'll receive an error like:
Exec format error
Just such a case manifests itself when using a script through cron (and run-parts). To remedy this problem put the following at the beginning of the script:
#!/bin/sh
That way, the system will know what to use when executing the script.

Man, you saved me. I’ve been looking for the source of the error for a hour at least, thinking there’s some shit with my lame use of exec.
I’m glad it was of help for you. GKoo
thanks mate. you saved me too.