Knowledgebase

Scheduling and Checking Cron Jobs Print

  • vpsservermanagement, cron, redirects, backup, guide, howto, solution, zillionkinghost
  • 0

Making sure scheduled work actually happens.

VIEWING EXISTING JOBS

crontab -l for the current user. Check each user that might have jobs, including root and your application users.

System-wide jobs live in /etc/cron.d and related directories.

CREATING ONE

crontab -e opens the editor. Each line specifies the schedule and the command.

Run jobs as the appropriate user, not root, unless root is genuinely required.

THE COMMON MISTAKES

Relative paths. Cron runs with a minimal environment; use full paths to commands and files. No output handling. Redirect to a log file, at least while testing. Scheduling everything at the same time, causing a load spike. Never checking whether it ran.

VERIFYING

Check the log you redirected output to Check the system log for cron entries

Check the effect: did the backup file appear, did the task complete

THE HABIT

After creating a job, wait for its first run and confirm it worked. A job that has silently failed for months is common and useless.

REVIEWING

Periodically list all cron jobs and remove those for software you no longer run.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot