Link to home
Start Free TrialLog in
Avatar of Simon
SimonFlag for Australia

asked on

Script error when run as a cronjob.

Linux Centos, When I run a script  manually, it works perfectly but when I run it as a cronjob it throws an error from within the script. My script is a simple launcher for a Python script as follows:

#!/bin/sh
#c21Launcher.sh

cd /
cd /usr/local/bin
Python2.7 /root/amqp_to_db/amqp_to_db.py &
cd /

The error that I get is that "Python2.7 is not recognised as a command!
ASKER CERTIFIED SOLUTION
Avatar of Nick Upson
Nick Upson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Simon

ASKER

am I not doing that with the first two lines of the script?

cd /
cd /usr/local/bin

That is where the Python2.7 file is!
you assume the current directory is in the PATH,
Avatar of Simon

ASKER

so should it be:

cd /
/usr/local/bin/Python2.7 /root/amqp_to_db/amqp_to_db.py

?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
your original one would work with "./python2.7 ...." but better to use use "/usr/local/bin/Python2.7 ...."