WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [SOLVED] Show the output of bootlocal.sh in an X terminal  (Read 2517 times)

Offline Ulysses_

  • Full Member
  • ***
  • Posts: 232
[SOLVED] Show the output of bootlocal.sh in an X terminal
« on: September 07, 2011, 07:03:13 PM »
Launching a little daemon-like script from inside /etc/bootlocal.sh because it requires root privileges. 

Can the output of bootlocal.sh appear in an X terminal that is automatically launched when X starts?
« Last Edit: September 08, 2011, 05:40:19 AM by Ulysses_ »

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: Show the output of bootlocal.sh in an X terminal
« Reply #1 on: September 07, 2011, 08:03:13 PM »
In my view that is not directly achievable as the '/opt/bootlocal.sh' process (even though it is run asynchronously) will probably be well and truly "gone" by the time the X server comes up.

Therefore I'd like to suggest you ensure that all components that you are interested in are writing (or 'tee'-ing) into a common log file (e.g. '/tmp/my.log') and then create a little script that gets run automatically when the X server starts (e.g. '~/.X.d/show_log.sh') with a contents along the lines of the following:
Code: (bash) [Select]
#!/bin/sh
LOG=/tmp/my.log
[ -s ${LOG} ] && xterm -e sh -c "less ${LOG}"

Offline Ulysses_

  • Full Member
  • ***
  • Posts: 232
Re: Show the output of bootlocal.sh in an X terminal
« Reply #2 on: September 08, 2011, 05:41:55 AM »
Thanks.  What does the following do?

[ -s ${LOG} ]

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: [SOLVED] Show the output of bootlocal.sh in an X terminal
« Reply #3 on: September 08, 2011, 07:33:50 AM »
This is to test whether the file exists and has a size greater than zero. So the remainder will only be executed if this condition is fulfilled.

Offline Ulysses_

  • Full Member
  • ***
  • Posts: 232
Re: [SOLVED] Show the output of bootlocal.sh in an X terminal
« Reply #4 on: September 08, 2011, 02:01:14 PM »
Alright.  And since my script is like a daemon that keeps producing output, I've replaced "less" with "tail -f".