this is in AIX..I need to take a backup of the file siebns. I need to take a backup of this file siebns.dat which is in the path /siebapps/siebel/gtwysrvr/sys
I need to take the backup of file everynight at 11:30 pm and shold delete the content in it which is older than 10 days..please provide all the steps involved
The answer that i got was::
I'm not sure whether I understood your requirement, but you could simply do
30 23 * * * /usr/bin/cp -p /siebapps/siebel/gtwysrvr/sys/siebns.dat /siebapps/siebel/gtwysrvr/sys/siebns.dat.$(date "+\%Y\%m\%d")
45 23 * * * /usr/bin/find /siebapps/siebel/gtwysrvr/sys -name "siebns.dat.*" -mtime +10 -exec rm {} \;
The first entry above creates a copy of the file in question in the same directory, appending a suffix "YYYYMMDD" to the name of the copied file, the second line deletes all files "siebns.dat.YYYYMMDD" older than 10 days in that directory.
YYYYMMDD means e.g. 20091122 for today.
the backup of this is working..but its not able to remove it after fewdays ..I tried to check it it only works if i do
rm -r *
Please help me with an extension siebapps/siebel/gtwysrvr/sys/siebns.dat.$(date "+\%Y\%m\%d")
not likr the above date ...anything that could be given a new name everyday and can easily be removed when this is run..
45 23 * * * /usr/bin/find /siebapps/siebel/gtwysrvr/sys -name "siebns.dat.*" -mtime +10 -exec rm {} \;