mirror of
https://github.com/jbowdre/phpipam-agent-docker.git
synced 2024-11-22 23:12:19 +00:00
friendlier way to set the scan intervals
This commit is contained in:
parent
614d0acdb8
commit
6702f36483
2 changed files with 25 additions and 4 deletions
|
@ -11,5 +11,5 @@ services:
|
||||||
- MYSQL_ENV_MYSQL_PASSWORD=phpipamadmin
|
- MYSQL_ENV_MYSQL_PASSWORD=phpipamadmin
|
||||||
- MYSQL_ENV_MySQL_PORT=3306
|
- MYSQL_ENV_MySQL_PORT=3306
|
||||||
- PHPIPAM_AGENT_KEY=2RuQ0rt4Rir29vGN4_1ZOqShcUX7PSUb
|
- PHPIPAM_AGENT_KEY=2RuQ0rt4Rir29vGN4_1ZOqShcUX7PSUb
|
||||||
- CRON_SCHEDULE=*/15 * * * *
|
- SCAN_INTERVAL=15m
|
||||||
- TZ=UTC
|
- TZ=UTC
|
||||||
|
|
|
@ -1,10 +1,31 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
[ -z "$CRON_SCHEDULE" ] && CRON_SCHEDULE="*/15 * * * *"
|
case "$SCAN_INTERVAL" in
|
||||||
|
5m) CRON_S="*/5 *"
|
||||||
|
;;
|
||||||
|
10m) CRON_S="*/10 *"
|
||||||
|
;;
|
||||||
|
15m) CRON_S="*/15 *"
|
||||||
|
;;
|
||||||
|
30m) CRON_S="*/30 *"
|
||||||
|
;;
|
||||||
|
1h) CRON_S="0 *"
|
||||||
|
;;
|
||||||
|
2h) CRON_S="0 */2"
|
||||||
|
;;
|
||||||
|
4h) CRON_S="0 */4"
|
||||||
|
;;
|
||||||
|
6h) CRON_S="0 */6"
|
||||||
|
;;
|
||||||
|
12h) CRON_S="0 */12"
|
||||||
|
;;
|
||||||
|
*) CRON_S="0 *"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "$CRON_SCHEDULE /usr/local/bin/php /opt/phpipam-agent/index.php update > /proc/self/fd/1 2>/proc/self/fd/2" > $CRONTAB_FILE
|
echo "$CRON_S /usr/local/bin/php /opt/phpipam-agent/index.php update > /proc/self/fd/1 2>/proc/self/fd/2" > $CRONTAB_FILE
|
||||||
echo "$CRON_SCHEDULE /usr/local/bin/php /opt/phpipam-agent/index.php discover > /proc/self/fd/1 2>/proc/self/fd/2" >> $CRONTAB_FILE
|
echo "$CRON_S /usr/local/bin/php /opt/phpipam-agent/index.php discover > /proc/self/fd/1 2>/proc/self/fd/2" >> $CRONTAB_FILE
|
||||||
chmod 0644 $CRONTAB_FILE
|
chmod 0644 $CRONTAB_FILE
|
||||||
|
|
||||||
exec "$@"
|
exec "$@"
|
||||||
|
|
Loading…
Reference in a new issue