Posts Tagged Exec format error

run-parts gives an exec format error

I got a problem the other day with a Linux script I made.
Basically, the script was working perfectly fine if I executed it directly from the command line but whenever I tried to run it with run-parts it failed!

This is the error message it returned:

%prompt> run-parts --report /etc/cron.daily
/etc/cron.daily/myscript:
run-parts: failed to exec /etc/cron.daily/myscript: Exec format error
run-parts: /etc/cron.daily/myscript exited with return code 1
%prompt>

Actually, the answer of this problem is quite simple! 🙂
I simply forgot the shebang on the first line of the script…

So, if you get the same error than me, make sure you have the following line at the beginning of your script:

#!/bin/sh

, , , , ,

5 Comments