What is the easiest way to monitor a bash script
into act? as in debugging it in real time wachting the processes forking, terminating ... etc
Thanks |
You could always try the "-x" flag, which will exho each command in the script as it runs. If you need to actually watch processes forking and terminating, you're probably going to need to have bash run the script under a debugger such as gdb.
|
Add a bedug mode i.e. set -xv just below the shebang, so you can check step by step execution of the script:
Code:
#!/bin/bash Code:
~$ bash -xv scriptname.sh |
if you need low level kernel trace (file i/o, fork, memory handling and similar) you can use strace: strace -o result [-f] <command>
it will work not only for shell script but for apps also. |
What if I use TOMOYO Linux? does it work as a debugger?
|
A debugger is a piece of software that can be run on any distribution.The tools mentioned above (strace, gdb, the -x flag) will work on any distribution.
|
A good logging system within bash's script would be helpful as well.
|
Quote:
It could be helpful if you would elaborate what the problem exactly is you're trying to solve. |
Quote:
|
Quote:
And also check some libraries like: log4sh, and bash-logger. |
Quote:
|
All times are GMT -5. The time now is 01:28 AM. |