3 ms·
Every few years, I try to set up a cron job. I carefully follow the instructions. It never runs.
by WalterBright 2y ago
Every few years, I try to set up a cron job. I carefully follow the instructions. It never runs.
- mke1982 2y agoAlways explicitly set the path to whatever it is in your shell, it's usually something to do with this.
- bravetraveler 2y agoYep. Time honored tradition, every cron is edited at least twice. Once to put it there, again to fix PATH. Everyone who does this enough knows it, everyone else [hopefully] rediscovers. Honest to goodness decades-long cargo culture. I prefer not having this problem, using "systemd timers" instead. The job and any forked work have a reasonable default path, and observability is worlds better. Did the last run succeed? When is the next? One command with timers, a guess with cron.
- sgarland 2y agoLiterally the only issue I’ve had with cron was a bug [0] for an absurd edge case that I found and fixed. [0]: https://bugs-devel.debian.org/1019716 https://bugs-devel.debian.org/1019716
- bravetraveler 2y agoCongratulations, myself and several dozens of people I know/mentor have repeated the history I mentioned
- dotancohen 2y agoCan you post an example? To where are you expecting to output to go? Does cron have permissions for that?
- ndsipa_pomu 2y agoMost of the time, it's because cron jobs are using a different environment (i.e PATH and other variables) than you'd expect. What I sometimes do is to put a "screen -dm" command to run from cron (e.g. if you set it to run each minute and then remove it once it's run). Then, connect to the screen session and you can examine and test what's going on with the environment.
- ycuser2 2y agoOne main reason for me is that it's not possible to run the job manually. You have to wait for it to run.