Skip to content

Instantly share code, notes, and snippets.

@kiyoka
Created January 24, 2012 12:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kiyoka/1669942 to your computer and use it in GitHub Desktop.
Save kiyoka/1669942 to your computer and use it in GitHub Desktop.
hourly restarter for Kahua workers
#!/bin/bash
# Please specify OT_SITE variable in config.sh
source config.sh
restart_workers() {
# ids of kahua workers
ids=`kahua-admin -S=$OT_SITE ls | awk ' $1 ~ /[0-9]+/ { print $1}'`
echo ids: $ids
# restart workers
for id in $ids ;
do
cmd="kahua-admin -S=$OT_SITE restart $id"
echo $cmd
$cmd
cmd="sleep 10"
echo $cmd
$cmd
done
}
while :
do
cmd=restart_workers
echo $cmd
$cmd
cmd="sleep 3600"
echo $cmd
$cmd
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment