Doc
This commit is contained in:
parent
9a3be2200b
commit
7aaae9cd6d
@ -15,15 +15,15 @@ Use
|
|||||||
|
|
||||||
To add it to the cron tab:
|
To add it to the cron tab:
|
||||||
|
|
||||||
crontab -e
|
sudo /etc/crontab
|
||||||
|
|
||||||
The add new line (to run the check once per hour)
|
The add new line (to run the check once per hour), don't forget to change the username:
|
||||||
|
|
||||||
1 * * * * /home/alban/outils/warn-if-broken/warn-if-broken-url.sh >/dev/null 2>&1
|
1 * * * * username /home/caracals/outils/warn-if-broken-url/warn-if-broken-url.sh > /dev/null 2>&1
|
||||||
|
|
||||||
|
|
||||||
**Note:**
|
**Note:**
|
||||||
- Normaly cron send task outputs (echo) via mail. As the MTA (Mail Transfert Agent), may not be set up,
|
- Normaly cron send task outputs (echo) via mail. As the MTA (Mail Transfert Agent), may not be set up,
|
||||||
the crontab line redirect the outputs into `/dev/null`.
|
the crontab line redirect the outputs into `/dev/null`.
|
||||||
- No sudo is needed, msmtp and crontab are call with current user.
|
- Sudo is needed to update the crontab. It also possible to set up your user crontab with `crontab -e`. In this case, remove `username` from the cron entry.
|
||||||
- The logs can be seen using (with sudo): `sudo grep CRON /var/log/syslog`
|
- The logs can be seen using (with sudo): `sudo grep CRON /var/log/syslog`
|
||||||
|
@ -4,10 +4,13 @@ set -eu
|
|||||||
|
|
||||||
URL="https://status.caracals.org"
|
URL="https://status.caracals.org"
|
||||||
|
|
||||||
SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
|
||||||
|
|
||||||
|
# Move in repo folder
|
||||||
|
SCRIPT_PATH="$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
|
||||||
pushd ${SCRIPT_PATH} > /dev/null
|
pushd ${SCRIPT_PATH} > /dev/null
|
||||||
|
|
||||||
|
|
||||||
|
# Test URL
|
||||||
if ret=$(curl -s -f "${URL}"); then
|
if ret=$(curl -s -f "${URL}"); then
|
||||||
echo "Marche"
|
echo "Marche"
|
||||||
else
|
else
|
||||||
@ -15,4 +18,5 @@ else
|
|||||||
cat msg.txt | msmtp alban.bronisz@gmail.com
|
cat msg.txt | msmtp alban.bronisz@gmail.com
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Move back
|
||||||
popd
|
popd
|
||||||
|
Loading…
Reference in New Issue
Block a user