phpipam-agent-docker/entrypoint.sh

34 lines
624 B
Bash
Raw Normal View History

2020-10-30 08:43:41 +00:00
#!/bin/sh
2020-10-29 17:09:23 +00:00
set -e
2022-01-06 16:02:16 +00:00
case "$PHPIPAM_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
2020-10-30 14:56:11 +00:00
2022-01-05 21:58:43 +00:00
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_S * * * /usr/local/bin/php /opt/phpipam-agent/index.php discover > /proc/self/fd/1 2>/proc/self/fd/2" >> $CRONTAB_FILE
2020-10-29 17:09:23 +00:00
chmod 0644 $CRONTAB_FILE
exec "$@"