You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When writing new cron files it's often nice to see what will actually happen when the next event in the crontab is reached. As far as I can tell there's no "simulation" option to make this happen.
What I propose is a new command line argument that requests that cron run any command(s) that would be due to execute at that precise moment in time, like this: cron --simulate . If you leave out it just runs the next command due to occur, and also prints the timestamp for the next even that would follow that one. Thus, if you wanted to simulate several events in a row, you would first do
cron --simulate
next task occurs in 3 hours and 5 minutes:
[next, the command would be run and the result sent to stdout]
and then finally cron would print
next event would be 2 days, 5 hours, and 1 minute later, at timestamp 341414211
this would allow you to continue the chain as far as you wanted.
obviously this would only run the events in the current user's crontab.
it might be nice to have the option of just printing out what the command would be, in addition to the option of actually executing the command. you could make that an interactive choice, since obviously this is not a feature that would be of use in scripts.
The text was updated successfully, but these errors were encountered:
it might be nice to have the option of just printing out what the command would be, in addition to the option of actually executing the command
Yeah, in fact I don't love the idea of anything initiated by a --simulate flag actually executing anything, since to my mind --simulate sounds awfully close to --dry-run or other, similar flags that mean, "explain, DON'T do". I would expect a crontab --simulate to display some information, without anything being run.
(And, really, it can't be a "proper" simulation, because the crontab command is running in your user session. Whereas when Cronie starts jobs from the user crontab, they're run in a very different process environment. So, that makes any such simulation inherently flawed.)
The idea of explaining what would be executed and when, that part's great. I'm all for that!
Edit: (I was going to suggest that a method of simulating actual runs of the crontab entries would be to run at now <the command used for the entry>, but now I see that at is completely separate from and unrelated to Cronie, so I guess that wouldn't be an accurate simulation either.)
When writing new cron files it's often nice to see what will actually happen when the next event in the crontab is reached. As far as I can tell there's no "simulation" option to make this happen.
What I propose is a new command line argument that requests that cron run any command(s) that would be due to execute at that precise moment in time, like this: cron --simulate . If you leave out it just runs the next command due to occur, and also prints the timestamp for the next even that would follow that one. Thus, if you wanted to simulate several events in a row, you would first do
cron --simulate
next task occurs in 3 hours and 5 minutes:
[next, the command would be run and the result sent to stdout]
and then finally cron would print
next event would be 2 days, 5 hours, and 1 minute later, at timestamp 341414211
this would allow you to continue the chain as far as you wanted.
obviously this would only run the events in the current user's crontab.
it might be nice to have the option of just printing out what the command would be, in addition to the option of actually executing the command. you could make that an interactive choice, since obviously this is not a feature that would be of use in scripts.
The text was updated successfully, but these errors were encountered: