diff options
| author | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-12-29 00:25:14 +0100 |
|---|---|---|
| committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2013-12-29 00:25:14 +0100 |
| commit | 9f4dadf606fd54c59fe7f02f714227655527ade6 (patch) | |
| tree | 0b05ffa0e167211d631c632e538d5674708feea6 | |
| parent | d898b51c087a249ed1531ad6c6f97d5823dd9c67 (diff) | |
| download | site-9f4dadf606fd54c59fe7f02f714227655527ade6.tar.gz | |
Run "crontab ~/etc/crontab" via Git hook
Install any changes made to our crontab(5) automatically.
| -rwxr-xr-x | libexec/post-receive.d/04-update-cron | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/libexec/post-receive.d/04-update-cron b/libexec/post-receive.d/04-update-cron new file mode 100755 index 0000000..ab305d5 --- /dev/null +++ b/libexec/post-receive.d/04-update-cron | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | # | ||
| 3 | # Copyright (c) 2013 Nagios Plugins Development Team | ||
| 4 | # | ||
| 5 | # Originally written by Holger Weiss <holger@zedat.fu-berlin.de>. | ||
| 6 | # | ||
| 7 | # This file is free software; the Nagios Plugins Development Team gives | ||
| 8 | # unlimited permission to copy and/or distribute it, with or without | ||
| 9 | # modifications, as long as this notice is preserved. | ||
| 10 | # | ||
| 11 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | # ANY WARRANTY, to the extent permitted by law; without even the implied | ||
| 13 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 14 | |||
| 15 | set -e | ||
| 16 | set -u | ||
| 17 | |||
| 18 | export PATH='/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' | ||
| 19 | |||
| 20 | prefix='/home/plugins' | ||
| 21 | |||
| 22 | # | ||
| 23 | # Check whether the "master" branch of the "site.git" repository has been updated. | ||
| 24 | # | ||
| 25 | if [ "${PWD##*/}" = 'site.git' ] | ||
| 26 | then | ||
| 27 | while read old new ref | ||
| 28 | do | ||
| 29 | if [ "$ref" = 'refs/heads/master' ] | ||
| 30 | then | ||
| 31 | crontab "$HOME/etc/crontab" | ||
| 32 | fi | ||
| 33 | done | ||
| 34 | fi | ||
