Problem description : I am using something called play framework in my development which requires me to make the python script play available in the path. Hence I create a symbolic link in /usr/local/bin ... Now I have written a shell script (call it status.sh) which calls this python script as follows :
play status <some values here related to my app> &> /tmp/xyz.txt and this shell script then sends me the file via email. This works perfectly when I execute the script as follows
./script.sh. However when the script is executed as a cron expression everyday I get an output from stderr saying 'play: command not found'.
Hence I did some digging on my own and here are my findings :
echo $PATHwhen I am on the shell shows that I have /usr/local/bin available to me hence I can successfully execute the command
- however when I type in
sudo bashand then
echo $PATHI do not have the path /usr/local/bin anymore. It is a limited set of folders (one of them being /usr/bin).
Q : Why this behavior ?! I fail to understand why the path is different. Also as a workaround would you suggest I do :
- new symbolic link from /usr/bin to /usr/local/bin (what are the side effects of this?)
- remove /usr/local/bin sym link altogether and only use /usr/bin
- is there a convention that I am not following here for linking new programs and executing them from