Tiny Core Linux
Tiny Core Base => TCB Q&A Forum => Topic started by: Ulysses_ 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?
-
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:
#!/bin/sh
LOG=/tmp/my.log
[ -s ${LOG} ] && xterm -e sh -c "less ${LOG}"
-
Thanks. What does the following do?
[ -s ${LOG} ]
-
This is to test (http://linux.die.net/man/1/test) whether the file exists and has a size greater than zero. So the remainder will only be executed if this condition is fulfilled.
-
Alright. And since my script is like a daemon that keeps producing output, I've replaced "less" with "tail -f".