3

Please look on my code – ( bash script )

I want to display both dialogs on the screen on the same time,

one dialog display the:

tail –f from - /var/log/proccess1.log ,

and the second dialog display the:

tail –f from the file - /var/log/proccess2.log

but the sad fact is that I can display only one dialog and not both dialogs ( because when I run the first dialog , the second dialog will activate only if the first dialog will killed )

So I create process on the second dialog ( ….. ) & , in order to display both dialogs

But …. the second dialog create process number but not create the second dialog GUI , ( seems that when we create dialog with process , the process not send the dialog to standard output )

So how to run the second dialog with process but send the dialog GUI to screen ? , or other solution in order to display both dialogs on screen

My code

     #!/bin/bash

     # this dialog will locate the tail box on the top of the screen
     dialog --begin 15 10  --tailbox   /var/log/proccess1.log  13 125 


     # this dialog will locate the tail box down in the screen
     ( dialog --begin 37 10  --tailbox   /var/log/proccess2.log    13 125 ) &
1

This is the first time I deal with dialog. Reading in the man page, I think this is what you are after:

#!/bin/bash

# this dialog will locate the tail box on the top of the screen
dialog --keep-window --begin 15 10  --tailboxbg  /var/log/syslog 13 125 \
       --and-widget  --begin 37 10  --tailbox    /var/log/dmesg  13 125
2

Try this:

dialog --keep-window --begin 0 0 --tailboxbg /var/log/process1.log 20 110 \
  --and-widget --keep-window --begin 0 120 --tailboxbg /var/log/process2.log 20 110 \
  --and-widget --begin 21 100 --msgbox "Press Enter to exit." 5 25

Adjust the numbers to fit your need. I had to use the msgbox to keep dialog alive.

  • 1
    Confirming that this works, but you have to keep the --msgbox doesn't work w/o that. – slm Sep 22 '14 at 11:45
1

How about making this in screen session? Two split windows with each tailbox inside...

I'm thinking about (this is a .screenrc config file):

startup_message off
screen dialog --begin 10 10  --tailbox   /var/log/proccess1.log  13 125
split
focus down
screen dialog --begin 10 10  --tailbox   /var/log/proccess2.log  13 125

To run, use: screen -c screenrcfile

HTH, Cheers

  • screen session isnt good for me , I want to implemned the case as described in my question – maihabunash Sep 21 '14 at 14:29
  • why this case is so complicated ? , must be solution here – maihabunash Sep 21 '14 at 14:41
  • You can also chain widgets but afaik it's not possible to have two at a same time. Try this, maybe it will suite your needs: dialog --begin 10 10 --tailbox /var/log/proccess1.log 13 125 --and-widget --begin 25 10 --tailbox /var/log/proccess2.log 13 125 – Scyld de Fraud Sep 21 '14 at 16:04
  • is there a solution for that? im looking for the same thing. – Asaf Magen Feb 20 '17 at 18:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.