2

I'm trying to making a small monitor to a program called showbf that print an updating itself every a certain amount of time.

my best try is the following

ssh user@server.foo "exit" 
if [ $? -ne 0 ]
then 
    ssh-add < /dev/null
fi

while true
do
resources=$(ssh user@server.foo "showbf")
if (echo "$resources" | grep -q "[0-9] procs") 
then
    echo $(echo "$resources" | awk '/[0-9] procs/ {print $1,"for",$5}')
else 
    echo "No procs available."
fi

if [[ $? == 0 ]] || [[ $? == 1 ]]
then
    exit 0
fi
sleep 1
done | zenity --text-info --height=200 --width=300 \
    --title "Resources available for immediate use (showbf)" 

I really don't like it because it appends the results to the previews. It becomes really messy. I'd like to use something like zenity --list (the results are 2 colums, num of proc available and walltime). But once zenity reads the data it does not update its contents. Any ideas??

Using while loops to recreate windows is not what I want because the new windows is replaced in the center of the screen.

Many thanks Salvatore

Community
  • 1
  • 1
Salvatore
  • 21
  • 1
  • 3

3 Answers3

2

Seven years late but better than never. This yad support forum addresses the issue for some people:

Re: [yad] Re: Can a yad window update itself? Exactly what Joe stated but, you have to use:

Child(yad -tail --> *.log --> Yad Parent(yad --text-info )

displayed and auto scrolling. This is not possible with zenity. See my below video:

https://www.youtube.com/watch?v=stPAWGXQyLY

WinEunuuchs2Unix
  • 1,801
  • 1
  • 17
  • 34
2

If you haven't already worked this out, you really should check out yad, a fork of zenity which is being actively improved. I only just installed it tonight (after bashing my head in trying to work around a bug in zenity), but I wouldn't be surprised if it could do what you want. I noticed it has a --tail option, for example. It's in fedora's repos, and that page has links to deb packages.

rsaw
  • 3,315
  • 2
  • 28
  • 30
  • I tried to use `yad` with `--text-info` and `--listen` but it only listen to stdin appended text, I would like it to check for a complete file change and update the text dialog – Aquarius Power May 21 '14 at 01:39
1

Instead of using zenity, why not bring up an xterm with a "watch" command it in which gets the necessary information. Something like:

xterm -g 80x40+100+100 -e "watch ssh user@server.foo showbf"
Seth Robertson
  • 30,608
  • 7
  • 64
  • 57
  • this is the solution I'm using, but with gnome terminal and screen. – Salvatore Jun 02 '11 at 23:46
  • this is the solution I'm using now, but with gnome terminal and screen. The reason why I would like to use zenity is to build some more complex script. Many thanks anyway! – Salvatore Jun 02 '11 at 23:52