Sponsored Content
Top Forums Shell Programming and Scripting Issue with Error handling,not able to continue the script further Post 302452274 by nss280 on Thursday 9th of September 2010 07:35:20 PM
Old 09-09-2010
Issue with Error handling,not able to continue the script further

Hi,

I am trying to write a script to cleanup files in a log directory ..

Code:
cd log
find Datk*[0-9]* -mtime +7 -exec rm -f {} \; 2> /dev/null


Have used the above to clean up files in log directory more then 7 days older.
The file can be something like ( auto-generate by some processes and other scripts )
Datk.010927346
Datk.85132523

If the file is not found in the directory then the code fails on find and errors out.

I dont want to code to error out, instead i want it to continue with further statements in the script.

What should I do to make it work?

Many Thanks

Last edited by nss280; 09-09-2010 at 08:36 PM.. Reason: Added the CODE tag !
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with Error Handling on Script

Hi, I need your guys help again. I run a script which check for some process status in a loop. when i check the process some of the process could throw an error, how can i check that inside my script. Thanks, RR (3 Replies)
Discussion started by: rrb2009
3 Replies

2. Shell Programming and Scripting

Error for "continue" keyword in Linux script.

Hi All I have a function in a linux script like this clean_up() { db2 -x "UPDATE ${DB_SCHEMA_NAME}.ETL_DAILY SET ETL_STATUS = 'SUCCESSFUL' WHERE PROCESS_DATE = '${INT_RUN_DATE}' AND BATCH_NO = ${CM_BATCH} AND APP_ID = ${APP_ID} AND APP_VERSION = '${APP_VERSION}'" > ${TMPOUT} ... (3 Replies)
Discussion started by: vee_789
3 Replies

3. Shell Programming and Scripting

Expect Script Error Handling

Good Day Everyone, I was hoping to get a little insight into an expect script that I've written. Basically we have this expect script to perform an sftp upload, key authentication is not an option, and sftp is the only method supported by our vendor, thus the need for this. I want to be... (3 Replies)
Discussion started by: thaller
3 Replies

4. Shell Programming and Scripting

Help me add Error Handling to my script

Hi all, I have some sections of a script that I am trying to add error handling to. Basically if it returns any error, just continue. This is for a deployment script that i am writing to assist in the deployment of scripts out to other systems. At the top of my KSH script i added this... (5 Replies)
Discussion started by: nitrobass24
5 Replies

5. Shell Programming and Scripting

error situation handling when starting app from a script

Hi, in my bash script I start 3rd party app that runs quickly normally and returns some data that I use later for processing. However if there are problems the app doesn't return anything and just hangs... then my script also hangs of course, awaiting for the app to comeback. Was wondering how to... (3 Replies)
Discussion started by: TomSu
3 Replies

6. Shell Programming and Scripting

UNIX file handling issue

I have a huge file semicolon( ; ) separated records are Pipe(|) delimited. e.g abc;def;ghi|jkl;mno;pqr|123;456;789 I need to replace the 50th field(semicolon separated) of each record with 9006. The 50th field can have no value e.g. ;; Can someone help me with the appropriate command. (3 Replies)
Discussion started by: Gurkamal83
3 Replies

7. Shell Programming and Scripting

ISSUE in handling multiple same name files :-(

Dear all, My work is completely stuck cos of the following issue. Please find it here and kindly help me. Task is following: I have set of files with such pattern 1t-rw-rw-r-- 1 emily emily 119 Jun 11 10:45 vgtree_5_1_pfs.root 3t-rw-rw-r-- 1 emily emily 145 Jun 11 10:46 vgtree_5_3_pfs.root... (4 Replies)
Discussion started by: emily
4 Replies

8. UNIX for Dummies Questions & Answers

File handling issue

Hi All, I am running into an issue. I have a very big file. Wants to split it in smaller chunks. This file has multiple header/ trailers. Also, between each header/trailer there are records. Number of records in each header trailer combination can vary. Also, headers can start with... (3 Replies)
Discussion started by: Gurkamal83
3 Replies

9. Shell Programming and Scripting

Script FTP maintain error handling

Hi, I have ftp script like below How to insert an error handling, If the transfer failed then send mail to me. Actually, I just need the script to send an email if the FTP failed. How to put the email script within FTP script? Thank You Edy (5 Replies)
Discussion started by: edydsuranta
5 Replies

10. Shell Programming and Scripting

Issue handling single quoted argument in shell script.

Below is my script that works fine and prints the desired output: #!/bin/ksh echo "$1" | while IFS= read -r dirpath do echo "DIRR_PATH:$dirpath" install_dir=$install_dir" "$dirpath done echo "Desired Output:$install_dir" Output: ./loopissue.sh... (10 Replies)
Discussion started by: mohtashims
10 Replies
strclean(1M)															      strclean(1M)

NAME
strclean - remove outdated STREAMS error log files SYNOPSIS
logdir] age] DESCRIPTION
cleans the STREAMS error logger directory of log files mm-dd) that contain error messages sent by the STREAMS log driver, strlog(7). If the option is not used to specify another directory, removes error log files in the directory. If the option is not used to specify another age, removes error log files that have not been modified in three days. Options recognizes the following options and command-line arguments: Specifies a directory for the location of the STREAMS error log files to be removed if this is not the default directory Specifies a maximum age in days for the STREAMS error log files if this not the default age of 3. The value of age must be an integer greater than or less than 3. EXAMPLES
Remove day-old error log files from a directory called FILES
One or more error log file or files on which operates. The mm-dd in the filename indicates the month and day of the messages con- tained in the file. NLS catalog for SEE ALSO
strerr(1M), strlog(7). strclean(1M)
All times are GMT -4. The time now is 12:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy