I write a script and set it as a cron job.
But due to a difference of environment variables it doesn't work as it should be.
In that case I change a little bit with crontab -e
and set a cron job time closest minute, and wait next minute to come to show the result. I feel this is a totally absurd approach, but I don't know better way to do it.
If there is a way to run a script as if it is called inside cron job, I'm going to use it.
Does anyone know how to do it?
Best Answer
Here is how to do the other way around: forcing cron execution to use your login environment:
bash -lc "your_command"
From the bash manual:
INVOCATION (a bit stripped):
To known more: