0 Replies - 1233 Views - Last Post: 28 July 2009 - 02:55 AM Rate Topic: -----

#1 Sun751   User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 57
  • Joined: 11-December 08

writing to log file

Posted 28 July 2009 - 02:55 AM

I have a question regarding log file,

I am working on a script which basically run system command to achieve some goal and in whole process I am suppose to run more than 25 command one by one in respective order at a time,

So rather than having noisy output on the screen

1. I am planning to redirect all the output system generated output to log file,
2. After every successful execution of command I am planning to write in the log file “respective command is success”<br>
3. If the execution fail write to log file.

And I have done following while I am in testing phase,

`(echo $command; $command )>> "$log" 2>&1`;

to capture system generated output.

open(LOG, ">>$log")|| die “Can’t open log file$!\n”;

						print LOG <<HEADING;
		print LOG "\n[Command Successful..\t]\n";
		print LOG "CMD: $command\n";
		print LOG "DES: $description\n";
		print LOG  scalar localtime();
		print LOG "\n";
		close LOG;

As I am going this for first time and I don’t have much experience, I am looking forward for suggestion!!!!



This post has been edited by girasquid: 28 July 2009 - 07:24 AM

Is This A Good Question/Topic? 0
  • +

Page 1 of 1