Pages

Monday, September 19, 2016

UNIX Script Practice

UNIX Script Practice:

Unix scripting requires extra stuff other than original stuff we try to do for audit purpose like create a log file and write important points like when this script used or how and who used it etc.

this requirement results in large script and also if used in the larger enterprise then list of the script looks too bad

to avoid this need to create some standard like which environment we should use which connection we should use how id and password should write etc.

also only creating standards not solve a problem because everybody will not follow standard perfectly and may requirement not let them do it also time constrains also comes to make bad scripting.

additionally to achieve goal some standard script should write properly which can just call in the original script.

for example, assume we need to create a script like to do a particular task like check file and named it as "Actual_do.ksh"
to keep standard we should know when this scrip run and what time so we can define this with writing it in the log file but what should be log file directory and what should be log file name?
for this we can setup standards like directory should be /home/log and log file name should be script name with .log extension like in this case should be "Actual_do.log" and to achieve this we can define another script to do this extra stuff and just call it in "Actual_do.ksh". let call it Extra_do.ksh

not write a script like it fetch script name and directory and export log file name and log file directory to used it directly in "Actual_do.ksh" instead in defined it and remember standards.


Also in actual work, this standards get too complex and developer start avoiding it due to not have any specific direction also code review will be very long and not accurate if we are not used it.