Search code examples
croncron-task

Cron job in centos


I have few more doubt in crontab jobs

My scenario: I have put two cron jobs at 23 Hrs every day 1 job is move files to another directory & the 2nd job is upload this file to ftp server.

  1. How to get last ran time cron job & last run result( if succeeded or failed )details in centos ?
  2. How to view at present running cron job in centos ? ( example : 1st job starting at 23 Hrs & the 2nd job starting at 23:30 Hrs and ending after 5 mins { assuming 1st cron job should be completed after 30mins , I want to view this job running details in live.(30 mints duration ) })

Log or live view

Note: Running as root user privilege.

Thanks G Dhamu


Solution

    1. You can watch the logs of jobs that were ran by cron under /var/log/cron (default location)
    2. You cannot have a "live view" since you're not the one who's running it... What you can do, is tail cron-log or have your program write its output to a different log and open a screen that tails it.