You are here:  » bad interpreter: No such file or directory - Solution


bad interpreter: No such file or directory - Solution

Submitted by redspan on Sun, 2008-06-08 17:26 in

Hi,

Not sure if this has been posted here before but I've just found this out so maybe it could help others.

I've had a site up for a while but couldn't figure out why some of my Fetch files failed to run. I knew that the syntax within the files themselves was correct because the contents copied and pasted into the command line on the server worked fine, but my Cron jobs kept returning this error:

: bad interpreter: No such file or directory

All files but one failed and I couldn't see any difference between the text file that worked and those that didn't. So I googled the error and found out that some invisible characters had crept into my text files and the quickest way to ensure that all files was correct was to do this:

Search your server for the dos2unix program:

[root@xxxxxx httpdocs]# locate dos2unix
/usr/bin/dos2unix
/usr/share/man/man1/dos2unix.1.gz
/usr/share/doc/dos2unix-3.1

Then run it against your file to convert ensure that it's a UNIX file:

[root@xxxxxx httpdocs]# /usr/bin/dos2unix -o myfetchfilename.sh
dos2unix: converting file myfetchfilename.sh to UNIX format ...

Of course, if you've got several files and you've named them with the same prefix then just put in a wildcard to convert them all:

[root@xxxxxx httpdocs]# /usr/bin/dos2unix -o myfetchfile*

They all should work when your Cron job calls them now, and you won't have to download them manually!

Regards,
Ben
Wardrobe Workout

Submitted by support on Mon, 2008-06-09 10:35

Hi Ben,

Thanks for that.

Cheers,
David.