|
Explain what is wrapper script, and where they use
it.
A wrapper is another script to "wrap around" existing script/s to do any of the following: 1) To control the execution of the main script/s (set environment variables, set aliases, etc). 2) To provide more information about the execution of the base script/s (display the time of execution, dump output to a log file, display the return code of the execution of the base script/s, etc). 3) Create a single point of entry to manipulate multiple scripts (For example, a simple script that displays Menu Options that will execute other scripts can be considered as a wrapper script). A wrapper script is a script that has got a bunch of other scripts and commands in them. A normal script will have stuff like: ls cp while true date echo
A wrapper script will refer to other scripts: /admin/check_precesses.sh if [ $? != 0 ] then echo "Checking of processes failed" exit 7 else /admin/report_processes.sh fi
Wrapper scripts are also used to capture all output of another script or scripts to a log file. A wrapper script is a master script which controls the execution of other scripts. For example- You have some scripts called A.sh, B.sh and so on... Now you have to run this scripts for a particular task one after another. Manually it would be a cumbersome task. So what you can do is write a wrapper around this scripts (also a script) which controls the execution of this scripts without the need to run them manually. It all depends upon the circumstances. |
|
See Also
Have a Unix Problem
Unix Books :-
Return to : - Unix System Administration Hints and Tips (c) www.gotothings.com All material on this site is Copyright.
|