if [[ -f /etc/planetlab/node_id ]] ; then
V=`cat /etc/planetlab/node_id`
else
- V=$RANDOM
+ if [[ ! -f ./node_id ]] ; then
+ echo $RANDOM > ./node_id
+ fi
+ V=`cat node_id`
fi
if [[ -f /etc/planetlab/plc_config ]] ; then
min=$(( $V % 60 ))
min2=$(( ($min + 10) % 60 ))
+min3=$(( ($min + 20) % 60 ))
# Run every three hours using a fixed point in time.
cat <<EOF > collect_and_upload.cron
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/home/${PLC_SLICE_PREFIX}_myops/
$min */1 * * * /home/${PLC_SLICE_PREFIX}_myops/collect.sh
$min2 */1 * * * /home/${PLC_SLICE_PREFIX}_myops/upload.sh
+$min3 */1 * * * /home/${PLC_SLICE_PREFIX}_myops/update.sh
EOF
-yum install -y lshw
+if [ ! -x /usr/sbin/lshw ] ; then
+ yum install -y lshw
+fi
+
+if [ ! -f /usr/boot/myops_cacert.pem ] ; then
+ mkdir -p /usr/boot
+ cp -f myops_cacert.pem /usr/boot/myops_cacert.pem
+fi
chmod 755 /home/${PLC_SLICE_PREFIX}_myops/collect.sh
chmod 755 /home/${PLC_SLICE_PREFIX}_myops/upload.sh
+chmod 755 /home/${PLC_SLICE_PREFIX}_myops/update.sh
crontab -u root collect_and_upload.cron
-