I'm trying to set up some automated tests using the Robot Framework's pybot script that allows you to execute Robot tests via shell. pybot, for those not familiar, is installed along with the Robot Framework to /usr/local/bin, and simply does:
#!/usr/bin/python
import sys
from robot import run_cli
run_cli(sys.argv[1:])
Effectively allowing you to evoke it "natively" from bash rather than python. Now, the way I'm trying to call pybot is as follows:
cd /var/www/parsingdev/meTypeset/tests && for file in ./*.txt; do pybot -d $(echo "/var/www/parsingdev/robot/"$(echo $file | sed -e "s/\.\///g" -e "s/\.txt//g")) $file; done
If I run this with sudo bash -c and wrap it all in single quotes, it works fine. If I save it to /opt/robottest.sh with a #!/bin/bash declaration as a first line and the command as the second line, and call it from the shell, it also works fine. However, none of the expected output files from the Robot tests are created when I use either of those methods to run it via root's cron, so something's not working.
I don't get it, though -- if I just do sudo env, it shows that /usr/local/bin is in the PATH, so it shouldn't be failing to find pybot, and otherwise I don't know why running it as sudo should be different from running it from root's crontab.
Thoughts appreciated!