I'm trying to create my first cron job. I'm new to bash scripting too, although I do know some python. I am puzzled by the following:
Here is my cronjob file created with crontab -e
:
*/1 * * * * /home/darren/.bash_scripts/urxvt_colors.sh
Contents of urxvt_colors.sh
:
#!/bin/bash
python ~/.Py_Scripts/xr_random_colors.py
xrdb ~/.Xresources
Here is what baffles me. So the python part of the cron job works python ~/.Py_Scripts/xr_random_colors.py
is executed every minute. This python script changes the color scheme in my ~/.Xresources
file. I confirmed this actually happens by checking every minute. But xrdb ~/.Xresources
does not update the file.
Running which python
shows /usr/bin/python
and which xrdb
shows /usr/bin/xrdb
. So since they are both executed from /usr/bin
, how come only the python script executes?
Also if I run ./urxvt_colors.sh
script manually from my terminal then it works as expected, the python script runs and so does xrdb ~/.Xresources
What's happening here?
~/
– jc__ Jun 22 '17 at 15:16