Creating Scripts
I am not Unix guru, so I need a little help here please. I have created two simple scripts, one which will basically backup a data directory onto a cdrw,the other will restore the directory from the cdrw. However, as the scripts are for my customer site, I would like to amend them to add a date stamp on the created file that gets burnt onto the cdrw. And would like the restore script to be able to recognise a date stamp to pull the files of the cd. Is there a way of creating arguments to do this please? ---------------------------- We could be a lot more help if you shared the script you
are currently using. Are you creating a tar file and copying it to the
cdrw ? Are you creating a iso image and burning that ?
---------------------------- Thnaks for the quick reply,I knew I should have put this
on the first time around, the scripts are as follows:
---------------------------- The output of
will show you the modification times of the files contained in the tarball. You should be able to grep for the file you would like to restore and compare the mod times to the current one on the host. If you just want the name of the tarball to include the time tar cvf `date +%Y%m%d`.tar /source/directory BTW you don't need to copy from the CD before doing the extract tar xvf /cdrom/cdrom0/data_backup.tar /usr/lsrc/wanadmin/data ---------------------------- But this still didnt achieve what I was aiming for. I
tired the following command:
And all the system did was to create a tarfile called `date +%Y%m%d`.tar and not put a date/time stamp which I wanted to do, as I explained I am a total Unix novice and have never been trained in the OS at all. ---------------------------- > all the system did was to create a tarfile called `date
+%Y%m%d`.tar
You could also try the alternative $() notation (ksh and bash) which does the same thing, i.e: tar cvf $(date +%Y%m%d).tar /source/directory ---------------------------- Ahhh, that will explain it, well I will try it out once more when I get the chance....and many thanks for the advice.
Have a Unix Problem
Unix Books :-
Return to : - Unix System Administration Hints and Tips (c) www.gotothings.com All material on this site is Copyright.
|