Unable to execute Ruby script in a Python script -
i'm having trouble executing ruby script python code.
my server has cron job supposed execute python script , ruby script. however, ruby script has executed after python one, decided add line:
os.system("ruby /home/username/helloworld.rb")
at end of python script.
it runs, i'm getting error in log file:
/bin/sh 1: ruby not found
i'm not sure why happening; i've tried calling exact same function in python console running python script manually, , both work perfectly. in other words, line of code doesn't work only when script triggered cron.
is there else need put in crontab/python script perhaps?
cron passes limited number of environment variables job. according crontab(5) man page:
shell
set/bin/sh
path
set/usr/bin:/bin
logname
,home
set/etc/passwd
line of crontab's owner.
home
,path
,shell
may overridden settings in crontab;logname
may not.
so if ruby
executable not located in either /usr/bin
or /bin
cron cannot find default.
you can specify path
within crontab include ruby executable though.
path=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin 17 * * * * python my_ruby_calling_script.py
Comments
Post a Comment