X-Git-Url: http://git.onelab.eu/?p=monitor.git;a=blobdiff_plain;f=automate-default.sh;h=8e7be9c5402921c91377e599ca332a1c6c807159;hp=73dc1103e196119807b9b4c27a3921fe219d761b;hb=6f2351e4b44590221425fa9b4bfa77c92db49b6a;hpb=19414270cf2c8429daab02fdebbd8081d9ba0db0 diff --git a/automate-default.sh b/automate-default.sh index 73dc110..8e7be9c 100755 --- a/automate-default.sh +++ b/automate-default.sh @@ -1,7 +1,10 @@ #!/bin/bash # NOTE: Must be an absolute path to guarantee it is read. -source /usr/share/monitor-server/monitorconfig.py +INSTALLPATH=/usr/share/monitor-server/ +# Generate an 'sh' style file full of variables in monitor.conf +$INSTALLPATH/shconfig.py > $INSTALLPATH/monitorconfig.sh +source $INSTALLPATH/monitorconfig.sh cd ${MONITOR_SCRIPT_ROOT} set -e DATE=`date +%Y-%m-%d-%T` @@ -29,6 +32,28 @@ if [ -f $MONITOR_PID ] ; then fi echo $$ > $MONITOR_PID +# SETUP act_all database if it's not there. +if [ ! -f ${MONITOR_SCRIPT_ROOT}/actallsetup.flag ]; then + if ! python -c 'import database; database.dbLoad("act_all")' 2>/dev/null ; then + python -c 'import database; database.dbDump("act_all", {})' 2>/dev/null ; then + touch ${MONITOR_SCRIPT_ROOT}/actallsetup.flag + fi +fi + + +AGENT=`ps ax | grep ssh-agent | grep -v grep` +if [ -z "$AGENT" ] ; then + echo "starting ssh agent" + # if no agent is running, set it up. + ssh-agent > ${MONITOR_SCRIPT_ROOT}/agent.sh + source ${MONITOR_SCRIPT_ROOT}/agent.sh + ssh-add /etc/planetlab/debug_ssh_key.rsa + ssh-add /etc/planetlab/root_ssh_key.rsa +fi +#TODO: should add a call to ssh-add -l to check if the keys are loaded or not. +source ${MONITOR_SCRIPT_ROOT}/agent.sh + + echo "Performing Findbad Nodes" ######################### # 1. FINDBAD NODES