Google logo

Monitor builds with Twitter

If you want to track the progress of a Fusion build when you are away from your computer, you can monitor it on Twitter. For an example, see Monitoring Fusion builds with Twitter is useful when you are out of the office and do not want to SSH into your server and check your builds manually.

In addition, you can modify this script so you can use it for email or other communication systems. Most Linux systems have a mail command for sending email, so you can simply replace the curl commands with the appropriate commands.

To set up Fusion for Twitter, you will need:

  • An Internet connection for your Fusion server.
  • A Twitter account for your Fusion server.
  • The cURL tool. (For the Ubuntu sudo apt-get install curl command.)
  • A cron job that is set to call the custom script below.

To set up Fusion for Twitter:

  1. Create a new file called getwitter.

  2. Save the file in a directory like /usr/bin/ so it is automatically in your path.

  3. Run the chmod command on the file to allow execution.

  4. Copy the code below to your getwitter file. Change the variables to reflect your Fusion server’s Twitter account credentials and, if needed, your server’s asset root.

    find $assetroot.state -iname "*.task" -ls >> /tmp/filelist
    declare -a inprogressarray
    declare -a queuedarray
    while read line
    asset=`echo $line | awk '{print $13}'`
    status=`/opt/google/bin/gequery --status $asset`
       if [ "$status" = "InProgress" ]; then
       if [ "$status" = "Queued" ]; then
    let taskcount=taskcount+1
    done </tmp/filelist
    for inprogress in ${inprogressarray[@]}
       logfile=`/opt/google/bin/gequery --logfile $inprogress`
          while read line
          done <$logfile
       curl --basic --user "$twittername:$twitterpass" --data-ascii
       "status=#GEEFusion Task$inprogresscount:
       curl --basic --user "$twittername:$twitterpass" --data-ascii
       "status=#GEEFusion Task$inprogresscount:
       let inprogresscount=inprogresscount+1
       curl --basic --user "$twittername:$twitterpass" --data-ascii
       "status=#GEEFusion Working on ${#inprogressarray[@]} task(s),
       ${#queuedarray[@]} queued &source=Google+Earth+Enterprise"
       rm /tmp/filelist
  5. Add this file to your cron tab and set it to go off every half hour or every hour.

    # crontab -e

  6. To run the Twitter update every 30 minutes, add the line:

    */30 * * * * /usr/bin/getwitter

  7. Follow your Fusion server on Twitter.