aboutsummaryrefslogtreecommitdiffstats
path: root/certs/org.onap.dmaap-bc.crontab.sh
blob: 861223c0515e24b86b03759fded6a129e5a6c3d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/bash /opt/app/osaaf/local/org.onap.dmaap-bc.crontab.sh
# Certificate Manager Crontab Loading Script
# Add/Update a Crontab entry, that adds a check on Certificate Manager generated Certificate nightly.
# Generated by Certificate Manager 2019-03-22T17:37:39.745Z
TFILE="/tmp/cmcron$$.temp"
DIR="/opt/app/osaaf/local"
CF="org.onap.dmaap-bc Certificate Check Script"
SCRIPT="/opt/app/osaaf/local/org.onap.dmaap-bc.check.sh"
crontab -l | sed -n "/#### BEGIN $CF/,/END $CF ####/!p" > $TFILE
# Note: Randomize Minutes (0-60) and hours (1-4)
echo "#### BEGIN $CF ####" >> $TFILE
echo "$(( $RANDOM % 60)) $(( $(( $RANDOM % 3 )) + 1 )) * * * /bin/bash $SCRIPT >> $DIR/cronlog 2>&1 " >> $TFILE
echo "#### END $CF ####" >> $TFILE
crontab $TFILE
rm $TFILE