Hi Robert, Check out the "logger" command. It allows you to append messages to the syslog. You can pipe output from commands to it for log entries. For example the following command:
cp -v install.log install.log.bak | logger -t "cp output" Generates the following log entry in messages: Jan 20 11:12:11 www cp output: `install.log' -> `install.log.bak' Hope this helps, Mike ----- Original Message ----- From: "Robert Adkins" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, January 19, 2003 9:54 AM Subject: Sending all output from 'cp' into a logf > Hello All, > > I have a script file that copies files over from our Server (Red Hat > 7.2, running Samba) to a back-up workstation running Windows 2000 Pro. > Anyway, this script is very basic. > > All it does is run 'cp -Ru' to copy all the data that has been updated > throughout the day on the server to the workstation for nightly tape > back-up. I know that I could have the tape drive in the Linux server, but > there are two reasons why I don't. > > One, I now have a daily "Hot" back-up of the previous day's data. This > will allow me to quickly restore any files that might be erroneously > deleted. > > Secondly, if something happens to me, the company will be left without a > Linux expert. In fact, there would be nobody in the company that could > support the servers. So, I have it setup to make it easy for the company > to replace the servers with Windows 2000 Servers (Spending much more > money of course.) and be able to easily hand those tapes over to the new > Admin for replacement. (They won't fire me, as I am also the Purchasing > Agent and have cut costs by several percentage points, same thing with IT > costs. I am only concerned with the possibility of my demise.) > > Anyway, this script is ran as a cron job each night and while I have > checked a few VERY important files to confirm that the last used version > of those files were indeed copied to the back-up workstation. However, > there can be hundreds of files that are new or updated versions on the > fileserver each day. Spot checking is useful, but I would rather have one > log file that I could look in to confirm which files were "replicated" to > the back-up server. > > I need something simple, that doesn't require additional services to be > added to the server. > > Does anyone know of some things that I can add to the bash script that I > wrote to provide me with that information in the log file? > > Thanks for any assistance you can render. Below are the contents of the > "hotback" script that I am using. > > #!/bin/bash > > cp -Ru /share/* /mnt/NetBack/ > > # This section merely generates the logfile showing that the > # process has completed each night that it is ran. > > echo -n "The hotback script has completed succesfully " | cat >> > /share/logfiles/dtcheck.log date | cat >> /share/logfiles/dtcheck.log > > #end script > > Is there a way to have 'cp' append what it is doing into the logfile? It > would be a great help to have it do so. Also, is there a method to keep > 'cp' from attempting to preserve permissions, as it is unable to do so > when it copies the files over to the NTFS shared piece on the > workstation. A plethora of 'unable to set permissions on such and such > file' error messages flies down the screen when 'cp' is ran. > > Thanks! > > Regards, > Robert Adkins II > IT Manager/Buyer > Impel Industries, Inc. > Ph. 586-254-5800 > Fx. 586-254-5804 > > > > > -- > redhat-list mailing list > unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe > https://listman.redhat.com/mailman/listinfo/redhat-list > -- redhat-list mailing list unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe https://listman.redhat.com/mailman/listinfo/redhat-list