File not found by run_rc_command

I'm having trouble with an rc script that is meant to start a python daemon. The script is a modified copy of an existing one that works. Only the names have been changed to ...
My system is FreeBSD 8.2.

The script is names pycron
Code:
#!/bin/sh

# PROVIDE: pycron
# REQUIRE: DAEMON mysql
# KEYWORD: shutdown

. /etc/rc.subr

name="pycron"
rcvar=`set_rcvar`
command="/usr/local/www/pycron/${name}.py"
command_interpreter="/usr/local/bin/python"

pidfile=/var/run/${name}.pid

load_rc_config $name
run_rc_command "$1"

When run with debugging on, using:
# /usr/local/etc/rc.d/pycron start
Code:
/usr/local/etc/rc.d/pycron: DEBUG: in run_rc_command: pidcmd is (rc_pid=$(check_pidfile /var/run/pycron.pid /usr/local/www/pycron/pycron.py python))
/usr/local/etc/rc.d/pycron: DEBUG: pid file (/var/run/pycron.pid): not readable.
/usr/local/etc/rc.d/pycron: DEBUG: checkyesno: pycron_enable is set to yes.
Starting pycron.
/usr/local/etc/rc.d/pycron: DEBUG: run_rc_command: doit: /usr/local/www/pycron/pycron.py  
eval: /usr/local/www/pycron/pycron.py: not found
/usr/local/etc/rc.d/pycron: WARNING: failed to start pycron

The file pycron does exist.
# ll /usr/local/www/pycron/
Code:
-rwxr-xr-x  1 root  wheel  840 Nov  3 10:11 /usr/local/www/pycron/pycron.py

I've run out of ideas. Can anyone help, please.
 
Wow...
Thanks for the quick reply.

The first line looks ok. It is
Code:
#!/usr/local/bin/python

It starts ok manually using # python pycron.py
 
You are correct. Trying to start with /usr/local/www/pycron/pycron.py does not work. The error is
Code:
Command not found

I have another python daemon with an identical first line that does start using its name. Both files have the same owner, group and permissions, but are in different directories. The owner, group and permissions for the two directories are the same.

One works, the other doesn't. I can't think of a reason for this?
 
Solved

Found the problem.

There is an ^M at the end of every line in the file.
FTP is supposed to take those out.
 
Back
Top