2020-03-06 17:09:11 +01:00
|
|
|
#!/bin/bash
|
2019-11-25 22:58:18 +01:00
|
|
|
|
2019-11-27 15:09:20 +01:00
|
|
|
# Create the misp cron tab
|
2019-11-26 22:18:52 +01:00
|
|
|
cat << EOF > /etc/cron.d/misp
|
2020-03-11 19:00:10 +01:00
|
|
|
20 2 * * * www-data /var/www/MISP/app/Console/cake Server cacheFeed "$CRON_USER_ID" all >/tmp/cronlog 2>/tmp/cronlog
|
|
|
|
30 2 * * * www-data /var/www/MISP/app/Console/cake Server fetchFeed "$CRON_USER_ID" all >/tmp/cronlog 2>/tmp/cronlog
|
2019-11-25 22:58:18 +01:00
|
|
|
|
2020-03-11 19:00:10 +01:00
|
|
|
00 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateGalaxies >/tmp/cronlog 2>/tmp/cronlog
|
|
|
|
10 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateTaxonomies >/tmp/cronlog 2>/tmp/cronlog
|
|
|
|
20 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateWarningLists >/tmp/cronlog 2>/tmp/cronlog
|
|
|
|
30 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateNoticeLists >/tmp/cronlog 2>/tmp/cronlog
|
|
|
|
45 3 * * * www-data /var/www/MISP/app/Console/cake Admin updateObjectTemplates >/tmp/cronlog 2>/tmp/cronlog
|
2019-11-25 22:58:18 +01:00
|
|
|
|
2019-11-26 22:18:52 +01:00
|
|
|
EOF
|
2019-11-25 22:58:18 +01:00
|
|
|
|
2020-03-11 19:00:10 +01:00
|
|
|
if [ ! -z "$SYNCSERVERS" ];
|
|
|
|
then
|
|
|
|
TIME=0
|
|
|
|
for SYNCSERVER in $SYNCSERVERS
|
|
|
|
do
|
|
|
|
cat << EOF >> /etc/cron.d/misp
|
|
|
|
$TIME 0 * * * www-data /var/www/MISP/app/Console/cake Server pull "$CRON_USER_ID" "$SYNCSERVER">/tmp/cronlog 2>/tmp/cronlog
|
|
|
|
$TIME 1 * * * www-data /var/www/MISP/app/Console/cake Server push "$CRON_USER_ID" "$SYNCSERVER">/tmp/cronlog 2>/tmp/cronlog
|
|
|
|
EOF
|
|
|
|
|
|
|
|
((TIME+=5))
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
2019-11-27 15:09:20 +01:00
|
|
|
# Build a fifo buffer for the cron logs, 777 so anyone can write to it
|
2020-03-06 17:09:11 +01:00
|
|
|
if [[ ! -p /tmp/cronlog ]]; then
|
|
|
|
mkfifo /tmp/cronlog
|
|
|
|
fi
|
2019-11-27 15:09:20 +01:00
|
|
|
chmod 777 /tmp/cronlog
|
|
|
|
|
|
|
|
cron -f | tail -f /tmp/cronlog
|