<p>You can use Build Periodically functionality under Build Triggers in Jenkins FreeStyle Job. (1)</p>

<p>At the Bottom of the Job Configuration, there is also a BUILD Menu with "Add Build Step" and you can execute shell. (2)</p>

<p>There is a POST BUILD Menu which you can use to send notifications once the build is done. (3)</p>

<p>Depending on how you want things done, you can have the whole script in (2) instead of splitting it into (2) and (3). </p>

<p><a href="https://i.sstatic.net/DdCN6.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/DdCN6.png" alt="enter image description here"></a></p>

<p><a href="https://stackoverflow.com/questions/47758319/build-triggers-in-jenkins">https://stackoverflow.com/questions/47758319/build-triggers-in-jenkins</a></p>

CC BY-SA 4.0
2019-09-23T08:00:11.537Z
2019-09-23T08:00:11.537Z
tnsh
<p>It's possible and pretty simple to do this with Jenkins. Here is a sample pipeline:</p>

<pre class="lang-java prettyprint-override"><code>pipeline {
    agent any

    triggers {
        cron('*/5 * * * *')
    }

    stages {
        stage('Health checker') {
            steps {
                sh 'curl https://mywebsite.com'
            }

            post {
                failure {
                    mail to: 'notify-list@example.com',
                        from: 'jenkins@example.com',
                        subject: "${env.JOB_NAME} - Failed",
                        body: "Job Failed"
                }
            }
        }
    }
}
</code></pre>

CC BY-SA 4.0
2019-08-22T12:28:35.297Z
[No space, please](http://english.stackexchange.com/questions/4645/is-it-ever-correct-to-have-a-space-before-a-question-or-exclamation-mark#comment206109_4645).
Peter Mortensen
CC BY-SA 4.0
2019-08-21T13:16:26.913Z
2019-08-22T12:44:28.083Z
2019-08-22T12:44:28.083Z
Hedi Nasr
<p>I'm trying to set up a way to constantly monitor a website that is built and deployed via Jenkins. A simple curl command would tell me if everything is OK, but how I would set up a job to do this every ~10 minutes? </p>

<p>Or would this be a bad idea?</p>

<jenkins>
Can/should I use Jenkins to monitor whether a website is up and send out an email if it's down?
zta
# Can/should I use Jenkins to monitor whether a website is up and send out an email if it's down?

(Asked by: username_0 on 2019-08-20)

I'm trying to set up a way to constantly monitor a website that is built and deployed via Jenkins. A simple curl command would tell me if everything is OK, but how I would set up a job to do this every ~10 minutes?

Or would this be a bad idea?

**Tags:** jenkins


---

## 2 answers

### Answer by username_1 on 2019-09-23. Score: 0 | Accepted answer

You can use Build Periodically functionality under Build Triggers in Jenkins FreeStyle Job. (1)

At the Bottom of the Job Configuration, there is also a BUILD Menu with "Add Build Step" and you can execute shell. (2)

There is a POST BUILD Menu which you can use to send notifications once the build is done. (3)

Depending on how you want things done, you can have the whole script in (2) instead of splitting it into (2) and (3).

[![enter image description here](https://i.sstatic.net/DdCN6.png)](https://i.sstatic.net/DdCN6.png)

<https://stackoverflow.com/questions/47758319/build-triggers-in-jenkins>


---

### Answer by username_2 on 2019-08-21. Score: 1

It's possible and pretty simple to do this with Jenkins. Here is a sample pipeline:
pipeline {
    agent any

    triggers {
        cron('*/5 * * * *')
    }

    stages {
        stage('Health checker') {
            steps {
                sh 'curl https://mywebsite.com'
            }

            post {
                failure {
                    mail to: 'notify-list@example.com',
                        from: 'jenkins@example.com',
                        subject: "${env.JOB_NAME} - Failed",
                        body: "Job Failed"
                }
            }
        }
    }
}

> **Comments:**
> **username_3**: [No space, please](http://english.stackexchange.com/questions/4645/is-it-ever-correct-to-have-a-space-before-a-question-or-exclamation-mark#comment206109_4645).  

---

