Find the answer to your Linux question:
Results 1 to 2 of 2
Hey guys i was just having trouble with a backup script im suppose to write, its suppose to be a backup script that has 2 arugments which backs up directories ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    1

    Simple back up script problem

    Hey guys i was just having trouble with a backup script im suppose to write, its suppose to be a backup script that has 2 arugments which backs up directories

    so far ive done this but im having trouble putting a second argument in , was wonder if any one could help me out with the script? or show me a simple backup script that has two arguments

    thanks in advance


    #!bin/bash
    DIRECTORIES=$1
    BACKUPDIR=$2
    Clear
    Echo “------------------------------------------“ >> /log.txt
    Echo “ “ >> /log.txt
    Echo “Date of backup made:” >> /log.txt
    echo “ ” ;date > thelog.txt
    echo “Backup made by $USER” >> /thelog.txt
    echo “The files are backed up to $2.tgz” >> /log.txt
    find $1 -mtime -1 –type f –print | tar –zcvf $2.tgz –T - >> /log.txt
    echo “Backup Successful” >> /log.txt
    exit

  2. #2
    tpl
    tpl is offline
    Linux User
    Join Date
    Jan 2007
    Location
    cleveland
    Posts
    452
    welcome to the forum

    because tar seems not to have a "-I" option--read
    files to archive from standard input, the best I
    can do is use an auxiliary file, thus:

    find $1 -atime +1 -type f -print > N
    tar czvf $2.tgz -T N
    rm N

    note also you are not consistent in referring to
    the log file.
    the sun is new every day (heraclitus)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...