Skip to content

Instantly share code, notes, and snippets.

@ebta
Last active May 11, 2021 02:24
Show Gist options
  • Save ebta/7d33bdfa3e1615525e2edb69d0d8ff87 to your computer and use it in GitHub Desktop.
Save ebta/7d33bdfa3e1615525e2edb69d0d8ff87 to your computer and use it in GitHub Desktop.
Check/verify cronjob crontab Linux Running

Cronjob Check

Referensi: https://askubuntu.com/a/85560

Do not redirect error output to /dev/null and grep /var/log/syslog for cron output.

grep cron /var/log/syslog

You can immediately show errors when saving a file after editing /etc/crontab or files inside /etc/cron.d/ with:

tail -f /var/log/syslog | grep --line-buffered cron

If the edit is ok, you will only see the RELOAD notice, errors will occur like

Jul 9 09:39:01 vm cron[1129]: Error: bad day-of-month; while reading /etc/cron.d/new 

Cron Status Check

Ref: https://askubuntu.com/a/792072

Although very rare, sometimes cron stops working properly even though the service is running. Here is how to verify that crond is running and stop/start the service.

On Linux:

service crond status
service crond stop
service crond start

On Ubuntu and other Debian-based systems:

service cron status
service cron stop
service cron start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment