Logging success event into file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Logging success event into file
# 1  
Old 07-25-2013
Logging success event into file

Hi,
I've the following code to log the errors any after the command is executed.
Code:
# Ksh 88 Version
 
log_path=/home/etc/fls/fls_log.log
del_path=/home/etc/fls/to_day
rm $del_path/* >> $log_path 2>&1

But I even want to log if the rm command is success without any error along with timestamp .
How can i achieve that .
Please advice ..

Thanks

Last edited by smile689; 07-25-2013 at 06:23 AM..
# 2  
Old 07-25-2013
Try

Code:
log_path=/home/etc/fls/fls_log.log
del_path=/home/etc/fls/to_day
message=$(rm $del_path/* 2>&1)
echo "$(date) $message >> $log_path

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Executing a job with file success

Hello All, I have a scenario where I need suggestion I am creating a file watcher job on autosys and and command job to do a SCP a file from one server to another. My file watcher will get success once the file get receive. The file I am receiving a zip file. THe command job which I am... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

2. Shell Programming and Scripting

Script to create folder, copy file, and send email on success

I am very new to UNIX as well as scripting so please be gentle, haha. I have a Linux client which has a mount point mapped to my /etc folder on a NetApp FAS system. I woudl like to be able to copy the hosts and rc files once a week from the FAS to a different location for backup. When the... (4 Replies)
Discussion started by: minnino
4 Replies

3. Shell Programming and Scripting

How to write SCP success or failure to a file

Does anyone know how to write the results (success and failure) to a file. I am using TCSH on a Solaris machine. I have the following code for a successful SCP...could someone help me add to this so it caputres failures also? CODE SO FAR (received from a previous post): scp sourcefile.txt... (3 Replies)
Discussion started by: thibodc
3 Replies

4. Shell Programming and Scripting

Event logging to file and display to console | tee command is not able to log all info.

My intention is to log the output to a file as well as it should be displayed on the console > I have used tee ( tee -a ${filename} ) command for this purpose. This is working as expected for first few outputs, after some event loggin nothing is gettting logged in to the file but It is displaying... (3 Replies)
Discussion started by: sanoop
3 Replies

5. UNIX for Dummies Questions & Answers

How to write code for a Logging Event?

How do I know what parts of the application to monitor and what means do I use to get this data? Can I use proc? What interactions are important and how do I view them?I would be more descriptive but I have not a clue. Thanks in... (18 Replies)
Discussion started by: theKbStockpiler
18 Replies

6. Shell Programming and Scripting

adding data in input file if 2nd script output SUCCESS

Hi All, how can i edit my original data and add more data if my 2nd script outputs SUCESS? ex. input file: 1.txt nik,is,the 1script.sh if 2ndscript.sh output SUCCESS then i'm going to edit my input file and add data best,pogi.. sample outputdata. nik,is,the,best,pogi 2ndscript.sh... (3 Replies)
Discussion started by: nikki1200
3 Replies

7. Shell Programming and Scripting

Curl ftp upload success but no file exist on the server !!!!

hello, I'm trying to upload a file to this ftp server and others ftp://ftp.byethost12.com as you can see in the output of CURL using the -v option curl reports that the upload succeeded but when i connected to the server with file-zilla there is no file uploaded the same command upload files... (5 Replies)
Discussion started by: laraaj
5 Replies

8. Shell Programming and Scripting

NDM process say success but file didn't reach destination

I am using ndmcli to NDM my files. When i do so it prints success for the process, with out any errors, but file is not reached at destination. ndmcli -x << EOJ submit phcdb process snode=$RMT_NODE_NAME step01 copy from (file=$SRC_FILE_NAME pnode) to (file=$DST_FILE_NAME snode... (0 Replies)
Discussion started by: pattamuthu
0 Replies

9. Shell Programming and Scripting

how to exit with success if the file is not found

I want to put a exit if there is no file found. In the directory I can have multiple txt files with EPISGCHGS as prefix or maynot have one. When I am trying the following it is erroring if there is no text file with the EPISGCHGS as prefix. for file in EPISGCHGS*.txt do cat $file >... (2 Replies)
Discussion started by: apps_user
2 Replies
Login or Register to Ask a Question