We help IT Professionals succeed at work.
Get Started

this is in AIX..I need to take a backup of the file siebns

aixtutorial
aixtutorial asked
on
352 Views
Last Modified: 2013-12-27
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 {} \;
Comment
Watch Question
CERTIFIED EXPERT
Most Valuable Expert 2013
Top Expert 2013
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE