4 ms·
What I'd like is a way to check that the command will run properly. Waiting for one minute to test is not productive at all. And no, testing in your shell won't
by joelthelion 10y ago
What I'd like is a way to check that the command will run properly. Waiting for one minute to test is not productive at all. And no, testing in your shell won't do, since cron runs in a particular environment.
- chrisan 10y ago> And no, testing in your shell won't do, since cron runs in a particular environment. Have you tried any of these answers? http://stackoverflow.com/questions/2135478/how-to-simulate-the-environment-cron-executes-a-script-with http://stackoverflow.com/questions/2135478/how-to-simulate-t...
- cmiles74 10y agoRunning a cron job that writes out it's environment and then running the job I'm testing in that environment has always worked pretty well for me. A hassle, but I've had good luck.
- therein 10y agoI was about to suggest the same. Just have your cronjob dump its environment for you so that you can simulate it more accurately.
- CraigJPerry 10y agoDifferent crons have different rules but assuming the ubiquitous vixie cron: env - HOME=$HOME LOGNAME=$LOGNAME sh -c 'command line' Home, shell and logname are the only 3 variables guaranteed to be set.
- taphangum 10y agoThis. Simulating cron's is the most frustrating thing I do in my workday.
- userbinator 10y agoWaiting for one minute to test is not productive at all. You could simply find something else to do for a minute, like rechecking that the other pieces of the system are setup correctly as well.