#!/usr/bin/tclsh #---------------------------------------------------------- # A script for deploying SICS servers easily # # Mark Koennecke, April 2015 #---------------------------------------------------------- set instlist [list amor boa dmc eiger focus hrpt mars \ morpheus narziss orion poldi rita2 sans sans2 tasp zebra] proc execCommand {command} { puts stdout "Doing $command" set status [catch {eval exec $command} msg] if {$status != 0} { puts stdout "ERROR: $msg " } } #----------------------------------------------------------- proc replaceServer {inst} { execCommand "ssh ${inst}@${inst} monit stop sicsserver" execCommand "ssh ${inst}@${inst} monit stop simserver" execCommand "scp ./SICServer ${inst}@${inst}:${inst}_sics" execCommand "ssh ${inst}@${inst} rm ${inst}_sics/core.*" # execCommand "ssh ${inst}@${inst} updatesicscommon" execCommand "ssh ${inst}@${inst} monit start sicsserver" execCommand "ssh ${inst}@${inst} monit start simserver" } if {[llength $argv] < 1} { puts stdout "usage:\n\tdeploysics instname| all" exit 1 } set inst [lindex $argv] if {[string compare $inst all] == 0} { foreach inst $instlist { replaceServer $inst } } else { replaceServer $inst } puts stdout "Done"