Error control


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error control
# 1  
Old 08-05-2014
Error control

I have the following bash
Code:
while read -r line; do
dcs_dportal_utl get all for $line >>file.txt
if
   CONTROL=$(date +"%d%m%Y_%H%M%S")
   echo -e $line 'Created_'$control >> control.txt
done < list.txt

sed '/^$/d' file.txt>list_jac.txt
echo '------------------ DONE' >> control.txt

this script generates a file with the information of each portal. But sometimes it failed and generate errors.

I need to include something to verify if there is an error, the program needs to tries and tries until all the information is ok.

Can anyone help me??

Last edited by rbatte1; 08-05-2014 at 01:23 PM.. Reason: Add CODE tags (Don Cragun) Indented & spaced code for clarity (RBATTE1)
# 2  
Old 08-05-2014
Is this a homework assignment? (Requests for help with homework assignments must be submitted in the Homework & Coursework Questions forum and must include a fully filled in template.)
# 3  
Old 08-05-2014
Thanks for your prompt response. No, this is not an assignment. I think I should go to the dummies forum. Please let me know if I need to post there. This is my first time in forus. Thanks.
# 4  
Old 08-05-2014
What errors do you get, and where? Does e.g. dcs_portal_utl give an exit code?

Last edited by rbatte1; 08-05-2014 at 01:21 PM.. Reason: Added ICODE tags
# 5  
Old 08-05-2014
Quote:
Originally Posted by RudiC
What errors do you get, and where? Does e.g. dcs_portal_utl give an exit code?
that command gives me a file with information like this one:

Equip Name (Cust Eq) ------ CONF
Portal Name --------------- BKP
Suspend Status ------------ Ok
Portal Description -------- output
Portal Associated Site ---- 0

but sometimes instead of that I get this:
Code:
Get failed!   Status: UIO0401 APP0000

so if I get that FAILED I need the script to try again until I get the info.

Thanks.


Moderator's Comments:
Mod Comment Please use CODE tags for code, input and output/errors. It makes it far easier to read.

Last edited by rbatte1; 08-05-2014 at 01:28 PM.. Reason: Added CODE tags
# 6  
Old 08-05-2014
What is missing from your if statement?
# 7  
Old 08-05-2014
Sorry, that if is not suppose to be there. this is the corrected code

Code:
while read -r line; do
   dcs_dportal_utl get all for $line >>cla_col_mci_portals.txt
   CONTROL=$(date +"%d%m%Y_%H%M%S")
   echo -e $line 'Created_'$control >> control.txt
done < portales.txt

sed '/^$/d' cla_col_mci_portals.txt>cla_col_mci_portals_jac.txt
echo '------------------ DONE' >> control.txt


Moderator's Comments:
Mod Comment Please use ICODE and CODE tags correctly as in the Forum rules.
Please also indent/separate your code to make it more easily readable.

Last edited by rbatte1; 08-05-2014 at 01:56 PM.. Reason: Changed CODE to ICODE for in-line statement and added CODE tags round a block, formatting to make it more readable.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

EXPECT Bash Script Error Control

Hello Geeks once more, Thanks for all the help you have been rendering.. I have a script that depends on the output of an expect statement but sometimes the main script misbehaves which I believe is a result of SSH communication error, how can I apply an error control to know whether the... (2 Replies)
Discussion started by: infinitydon
2 Replies

2. BSD

Fan control

Hi all, Is there any way that I can get some control over th fan in my Evo N400C laptop running OpenBSD 4.0? Right now the fan is running constantly and it woulf be nice if it could be quiet sometime. (1 Reply)
Discussion started by: Timmy66
1 Replies

3. Shell Programming and Scripting

Job control

Hello, What is the best way to control the running of scripts? For example, i have a k1.ksh script java pgm that checks to make sure that the file counts in a particular directory are equal to a total file count value in a control file updated from my PC. If i run this k1.ksh script and... (3 Replies)
Discussion started by: bobk544
3 Replies

4. Solaris

About Control-M Scheduler

Hi all, Is anybody have any idea on Control-M schedular(bmcsoftware product) on Solaris/UNIX environment.If yes,can you please help me how to set it up and schedule a job. Please!!! it's Urgent!!! Regards, Uday (0 Replies)
Discussion started by: uday123
0 Replies

5. UNIX for Advanced & Expert Users

New to Control-M

Hi, I am very new to Control-M . If anywone know about the global conditions in Control-M. (5 Replies)
Discussion started by: oraclenerd
5 Replies

6. Solaris

Control system

I want to check system memory Usage of CPU and disk and report number of free disk block in Sun Solaris How can I do Help me thks (2 Replies)
Discussion started by: iwbasts
2 Replies

7. Shell Programming and Scripting

Removing control-Ms (^M)

Anyone know how to remove ^M's from a text file using sed command? (6 Replies)
Discussion started by: djkane
6 Replies

8. Shell Programming and Scripting

Control the telnet

In my system , all user login are via telnet , we have control that only allow max. 300 telnet session in the system , now if I want to keep the max. no of telnet unchange (300) , but three specific users ( eg. userA , userB ,userC ) not count into this 300 session , is it possible ? for... (0 Replies)
Discussion started by: ust
0 Replies

9. Filesystems, Disks and Memory

Access Control

In Windows XP, there are 3 default access control groups namely: Administrators, Users and Power Users. Is there default access control groups in Unix system? If there is, what are they? newbie. (1 Reply)
Discussion started by: zertoir
1 Replies
Login or Register to Ask a Question