02-13-2012
KSH script help needed ( nice error trap routine ?)
I am running a script that runs a loop and executes a command on ${i} until the end of the for loop.
From time to time the command generates an error ( which is good) for example ERROR0005:
How can I trap the error and send an email echoing the ${i} variable in the loop and the error ?
and or better yet run a command that fixes the error based on ${i} + the error code?
This is a RH Enterprise 5.x OS using the K-Shell ( we moved from a Unix to linux environment and have hundreds of scripts to migrate so we kept the ksh format to make life easier)
10 More Discussions You Might Find Interesting
1. Programming
Hi I want to implement the nice command in the shell that I am building. I came to know that there is a corresponding nice() system call for the same. But since I will be forking different processes to run different commands typed on the command prompt, is there any way I can make a command... (2 Replies)
Discussion started by: tejbuch
2 Replies
2. Shell Programming and Scripting
Hi folks,
I have tried to add some trap detection in the below script....this script is used to monitor database activities...in a rather awkward way :rolleyes:....
The idea behind adding trap is that....this script creates lots of temporary files in the running folder to store the count... (1 Reply)
Discussion started by: frozensmilz
1 Replies
3. Shell Programming and Scripting
I have a rather simple routine that I would like to fine tune. I am having scripters block if that exists. Trying to tally up that amount of subnets after I performed an awk and uniq from zipped apache logs. For instance, on a solaris 10 system:
This does work
gunzip -c access_log1.200834.gz |... (2 Replies)
Discussion started by: NYG71
2 Replies
4. Shell Programming and Scripting
Hey all UNIX nerds- I've built a shell script which runs pretty well- only I want it to have much better error trapping. (Like the kind I could apply to every shell script I write).
I'm not a UNIX genius, and could really use a bit of help.
The original script goes something like this:
1... (3 Replies)
Discussion started by: stevekerver
3 Replies
5. Shell Programming and Scripting
I have another Question:
I tried to run the following script: (I actually wanted to print out the second field in the text field.)
#!/usr/bin/ksh
set -x
readfile=/dir1/data.txt
cat $readfile | while read line
do
x = `echo $line|awk '{print $2}'`
echo $x
done
But, it shows the... (3 Replies)
Discussion started by: ss3944
3 Replies
6. Shell Programming and Scripting
I have a script that prompts the user for a response. How can I use the trap command to capture the question ask and the users response to a log file?
Thanks in advance,:D (1 Reply)
Discussion started by: toor13
1 Replies
7. Shell Programming and Scripting
Hello,
I am just starting with shell scripting, as everyone will soon see from my question. What I'm trying to do is call the Nice command to set the script process priority from /bin/ksh. The difference is I'm running it not directly through the shell, but through Bigfix (very similar to... (3 Replies)
Discussion started by: solly119
3 Replies
8. Shell Programming and Scripting
Dear Members,
I have a table in Oracle DB and one of its column name is INFO which has data in text format which we need to fetch in a script and create an xml file of a new table from the input.
The contents of a single cell of INFO column is like:
Area:app - aam
Clean Up Criteria:... (0 Replies)
Discussion started by: Yoodit
0 Replies
9. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
That is the last reply I received from my instructor, and I'm looking for some alternatives.
When using... (2 Replies)
Discussion started by: newuser45
2 Replies
10. Shell Programming and Scripting
sqlplus -s usrname/password@dbSID <<-SQL >> logfile
@create_table.sql
commit;
quit;
SQL
I am running this script to execute an sql file.
I want to display the oracle error if anything found during execution of the sql file and exit from script.
Please suggest How do it. (1 Reply)
Discussion started by: millan
1 Replies