I have problem in accessing a shell variable while running cron job. Actually i created a job which prints two shell variable values into a env.output
file.
I am writing cron job using command $ crontab -e
(without sudo user).
My crontab configuration file looks like this:-
# varibales
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:
/usr/games:/usr/local/games
MAILTO=abc@xyz.com
HOME=/home/ubuntu
JOBS_PATH=${HOME}/cronjobs
# Jobs
* * * * * echo "$HOME and $JOBS_PATH" >> ${HOME}/env.output 2>&1
So, now when i see the contents of file env.output
, i get this output
/home/ubuntu and ${HOME}/cronjobs
which is not expected i assumed.
I want my output should looks like this:-
/home/ubuntu and /home/ubuntu/cronjobs
Suggest me some way to handle this issue.