<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Em 25/01/2010 16:56, Lennart Andersen escreveu:
<blockquote cite="mid:570142.12346.qm@web88106.mail.re2.yahoo.com"
 type="cite">
  <style type="text/css"><!-- DIV {margin:0px;} --></style>
  <div
 style="font-family: times new roman,new york,times,serif; font-size: 12pt;">
  <div>How about something like this......<br>
  <br>
#!/bin/bash<br>
  <br>
# This script makes a backup of the files on the primary server
directory.<br>
  <br>
# Change the values of the variables to make the script work:<br>
BACKUPDIR=/data/<br>
BACKUPFILES=*.cdf<br>
GZTARFILE=/var/tmp/data_$(date +%F).tar.gz<br>
SERVER=mcastasp1<br>
REMOTEDIR=/home/admin/DATA_BKP<br>
LOGFILE=/home/admin/DATA_BKP/backup.log<br>
CLEANUP=/home/admin/DATA_BKP<br>
  <br>
cd $BACKUPDIR<br>
  <br>
# This creates the archive<br>
tar zcf $GZTARFILE $BACKUPFILES > /dev/null 2>&1<br>
  <br>
# Create Remote backup Directory<br>
ssh $SERVER 'mkdir -p /home/admin/DATA_BKP'<br>
  <br>
# Copy the file to another host - we have ssh keys for making this work
without intervention.<br>
scp $GZTARFILE $SERVER:$REMOTEDIR > /dev/null 2>&1<br>
  <br>
# Redirect errors because this generates some if the archive<br>
# does not exist.<br>
rm $GZTARFILE 2> /dev/null<br>
  <br>
# Create a timestamp in a logfile.<br>
date >> $LOGFILE<br>
echo backup succeeded >> $LOGFILE<br>
  <br>
# Clean up remote server and leave 7 days of backup files<br>
ssh $SERVER 'find /home/admin/DATA_BKP/ -follow -name 'data_*' -ctime
+7 -exec rm {} \;'<br>
  </div>
  <div
 style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><br>
  <div style="font-family: arial,helvetica,sans-serif; font-size: 13px;"><font
 face="Tahoma" size="2">
  <hr size="1"><b><span style="font-weight: bold;">From:</span></b>
Alan Hoffmeister <a class="moz-txt-link-rfc2396E" href="mailto:alangtk@gmail.com"><alangtk@gmail.com></a><br>
  <b><span style="font-weight: bold;">To:</span></b> <a class="moz-txt-link-abbreviated" href="mailto:centos@centos.org">centos@centos.org</a><br>
  <b><span style="font-weight: bold;">Sent:</span></b> Mon, January 25,
2010 1:48:19 PM<br>
  <b><span style="font-weight: bold;">Subject:</span></b> [CentOS] Bash
script for backup<br>
  </font><br>
Hello guyz!<br>
  <br>
I'm new here, and this is my very first truble...<br>
  <br>
I need a script that will backup & compress the folder
/media/system in <br>
the folder /media/backups<br>
  <br>
But that's not the problem, I need that only the last 7 backups (last 7
  <br>
days, yeah I know, cronjob...) will stay in that folder...<br>
  <br>
The script need:<br>
1 - Compress folder /media/system<br>
2 - Store in /media/backups<br>
3 - Name the compressed backup like day_month_year.tar.gzip<br>
4 - Check the other backups and delete backups older than 7 days..<br>
  <br>
Can some one help me?<br>
  <br>
Tanks!</div>
  </div>
  </div>
</blockquote>
<br>
This is what I want! But there is just one problem, I don't need SSH, I
just need a folder on the local machine that will have the 7 days
backup, then I'll use rsync for on remote server, but this part I
already have. How can I use this script whitout the SSH?<br>
<br>
</body>
</html>