8000 GitHub - rmgas1/run-as-cron: Run a command or a script as cron would
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

rmgas1/run-as-cron

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

run-as-cron

This script runs a command just like cron would.

This is useful to debug a command that, when scheduled by cron, has unexpected behaviour.

Why isn't cron running my script "correctly"?

cron does not run a script is the very same way as if you run it from a regular user console. Indeed, cron runs it:

  • with a modified environment
  • with a specific shell, which may or may not be your usual shell
  • without an attached input terminal
  • in a non-interactive shell

This script tries hard to mimic this behaviour, so that it easily helps debugging cron scripts.
An alternative way of debugging would be to schedule your script with cron in the following minute, but that limits to one attempt per minute (and causes risking to forget to un-schedule the cron task).

Credits

This scipt stemmed from some Stack Overflow discussions.

Credits go to:

  • daladim
  • poleguy
  • (and maybe others, check the merged pull requests)

About

Run a command or a script as cron would

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%
0