Thomas Vachuska | eef7f3a | 2015-03-18 21:01:04 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | #------------------------------------------------------------------------------- |
| 3 | # Test utility to spawn an iTerm window for monitoring logs of current cell. |
| 4 | #------------------------------------------------------------------------------- |
| 5 | |
| 6 | cellName=$ONOS_CELL |
Claudine Chiu | 45312d0 | 2016-06-15 13:17:12 +0000 | [diff] [blame] | 7 | nodeCount=$(env | egrep "^OC[0-9]+" | wc -l | tr -d ' ') |
Thomas Vachuska | eef7f3a | 2015-03-18 21:01:04 -0700 | [diff] [blame] | 8 | |
| 9 | osascript -e " |
| 10 | tell application \"iTerm\" |
| 11 | |
| 12 | set cellName to \"$cellName\" |
| 13 | set paneCount to $nodeCount |
| 14 | |
Thomas Vachuska | f3e12d0 | 2017-01-09 15:46:18 -0800 | [diff] [blame] | 15 | set theTerm to (create window with default profile) |
Thomas Vachuska | eef7f3a | 2015-03-18 21:01:04 -0700 | [diff] [blame] | 16 | |
| 17 | tell theTerm |
Thomas Vachuska | eef7f3a | 2015-03-18 21:01:04 -0700 | [diff] [blame] | 18 | launch session \"Default\" |
| 19 | tell the current session |
Thomas Vachuska | f3e12d0 | 2017-01-09 15:46:18 -0800 | [diff] [blame] | 20 | set columns to 256 |
| 21 | set rows to 64 |
Thomas Vachuska | eef7f3a | 2015-03-18 21:01:04 -0700 | [diff] [blame] | 22 | set name to \"ONOS Log 1\" |
| 23 | write text \"cell \" & cellName |
| 24 | write text \"oi 1 && clear && echo Node \$OCI && ol\" |
| 25 | end tell |
| 26 | end tell |
| 27 | |
| 28 | tell theTerm |
| 29 | repeat with thePane from 2 to paneCount |
| 30 | tell the current session |
| 31 | tell application \"System Events\" to keystroke \"D\" using command down |
| 32 | set name to \"ONOS Log \" & thePane |
| 33 | write text \"cell \" & cellName |
| 34 | write text \"oi \" & thePane & \" && clear && echo Node \$OCI && ol\" |
| 35 | end tell |
| 36 | end repeat |
| 37 | end tell |
| 38 | |
| 39 | tell application \"System Events\" to keystroke \"I\" using command down |
| 40 | |
| 41 | end tell |
| 42 | " |