Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jenkins to monitor external cron jobs

Tags:

cron

jenkins

We are using a dedicated Amazon Ubuntu ec2 instance as Cron server, which executed 16 cron jobs at different time intervals i.e, 10 cron jobs in morning 4:15 - 7:15 and the rest @ 23:00 - 23:50. I get the results via email. I want to configure something, which shoots email message at the end of they day listing the cron jobs that are executed successfully and the one that failed.

I have a jenkins configured ubuntu instance for auto-building Dev, Beta, Staging & Live environments. Can i add these cron jobs(shell scripts) as external jobs in the jenkins and monitor them. Is it possible?

like image 299
Sangram Anand Avatar asked Dec 21 '22 04:12

Sangram Anand


2 Answers

Definitely possible! You can monitor external cron jobs as described here: https://wiki.jenkins-ci.org/display/JENKINS/Monitoring+external+jobs

You can also add cron job (-like behavior) to Jenkins by creating a freestyle software project and add "Execute shell" as build process. It's a bit more convenient since you can also trigger the execution via Jenkins ("Build now").

like image 70
Paul Voss Avatar answered Dec 23 '22 16:12

Paul Voss


You might be able to combine the Jenkins monitor external job project type with a matrix project. At the very least the former will enable you to monitor the cron jobs individually.

Alternatively you could have the last monitored cron job of the day trigger building a project that checks the status of all the cron jobs (for example by retrieving and comparing the build numbers of the last and the last successful builds) and sends an email accordingly. The email plugin might be useful for the latter.

like image 30
Lars Kotthoff Avatar answered Dec 23 '22 18:12

Lars Kotthoff