In my crontab I want to do something like:
# crontab
PYTHONPATH=$HOME/python_proj_dir/
SC=$PYTHONPATH/script_dir/ # SC = ShortCut
0 * * * * python27 $SC/script.py
However only doing:
PYTHONPATH=/home/me/python_proj_dir/
works. The line running the python script won't even work if SC=/home/me/python_proj_dir/script_dir/.
I also tried first setting HOME:
HOME=/home/me/
0 * * * * python27 $HOME/script.py # This does not work
The errors I got were similar to:
python27: can't open file '$HOME/script.py': [Errno 2] No such file or directory
I have gotten it to work by using full/absolute paths, but I want to use a variable $SC (shortcut) so that the lines aren't over 9000 characters long, and so that it is easy to move the project to, for example another users dir or a new company server by simply changing $SC.
I saw this, but it was for sending a variable to a program.