Added simplified ConfFile entry using myops_setup_sh
[myops.git] / web / collect / client / collect.sh
index 5bbc108..f8c49ce 100644 (file)
@@ -9,6 +9,12 @@ LOGFILE=/home/${PLC_SLICE_PREFIX}_myops/myops.log
 
 cd /home/${PLC_SLICE_PREFIX}_myops
 
+if [ -f /usr/boot/cacert.pem ] ; then
+       CURL_ARGS="$CURL_ARGS --cacert /usr/boot/cacert.pem"
+else
+       CURL_ARGS="$CURL_ARGS --insecure"
+fi
+
 # TODO: add a timeout to eval, that kills children after X seconds
 function write_key_command ()
 {
@@ -22,7 +28,7 @@ function write_key_value ()
     key=$1
     value=$2
     (
-        flock -s 200
+        flock -x -w 240 200 2> /dev/null
         echo $key : $value >> $LOGFILE
     ) 200>/var/lock/myops
 }
@@ -42,7 +48,7 @@ while read key colon command ; do
                      fi
                 fi
         fi
-done < <( curl --silent http://IPADDR/PlanetLabConf/input.cfg )
+done < <( curl $CURL_ARGS -s https://IPADDR/PlanetLabConf/input.cfg )
 
 write_key_value "count" "$count"