Results 1 to 9 of 9

Thread: ubuntu server backup

  1. #1
    Member
    Join Date
    May 2005
    Location
    waraynon.com
    Posts
    93

    ubuntu server backup

    is there a way or perhaps a script that the files from the server can be archive or be zipped?
    .sig na ture.

  2. #2
    Gonzo District BOFH westin's Avatar
    Join Date
    Jan 2006
    Location
    SW MO
    Posts
    1,187
    You could use tar to make an archive. Although, I am really not sure exactly what you are trying to do...
    \"Those of us that had been up all night were in no mood for coffee and donuts, we wanted strong drink.\"

    -HST

  3. #3
    Senior Member gore's Avatar
    Join Date
    Oct 2002
    Location
    Michigan
    Posts
    7,177
    Ubuntu is a little different from most distros, but I'm pretty sure it still has the base Linux installation stuff, which means if you need to do this you shouldn't need any extra software. Tar was mentioned already and is an easy to basically make a huge file of a bunch of other files, and then you can gzip it into a little tar.gz file, which is a gzipped tarball.

    Also, you can use bunzip2 which has better compression normally, but also takes longer to make the file.

    And 7Zip generally comes with most Linux distros. try this:

    apt-get install 7zip

    If it doesn't work, or says it's already installed you're done there and can use that, or, just use that normal tar and gzip.

  4. #4
    Member
    Join Date
    May 2005
    Location
    waraynon.com
    Posts
    93
    my boss actually needs this or (or maybe he knows already and wants to test me) and he wants me to find script or a command on the cronjobs that can zip, gzip, tar.
    .sig na ture.

  5. #5
    Senior Member gore's Avatar
    Join Date
    Oct 2002
    Location
    Michigan
    Posts
    7,177
    Managers are idiots. He's probably thinking Winzip. Which works on Windows.

    In all seriousness, if you need to find this in a CronJob....Well, go to /etc:

    cd /etc

    Then read what Cron Jobs have been set already and see if there is one someone added in there that actually does this, or you could, well, I guess you could add one where you zipped up certain files and directories, most distros come already with zip and Gzip now, bit the standard one that's normally there is gzip.

    For multiple files, remember to tar them first

    you can check out more with this:

    man tar

    man gzip

  6. #6
    AO's Filibustier Cheap Scotch Ron's Avatar
    Join Date
    Nov 2008
    Location
    Swamps of Jersey
    Posts
    378
    For large compressed files, I prefer bzip2. Better compression, but you pay for it somewhat in longer comp/decomp wall times. google "bzip2 vs gzip" if you want to understand in more detail.

    man bzip2
    In God We Trust....Everything else we backup.

  7. #7
    Senior Member gore's Avatar
    Join Date
    Oct 2002
    Location
    Michigan
    Posts
    7,177
    Quote Originally Posted by Cheap Scotch Ron View Post
    For large compressed files, I prefer bzip2. Better compression, but you pay for it somewhat in longer comp/decomp wall times. google "bzip2 vs gzip" if you want to understand in more detail.

    man bzip2
    That's what I meant to say by bunzip2 in my first reply. Wasn't thinking straight and only gave the unzip version by mistake.

  8. #8
    Shrekkie Reloaded Raiden's Avatar
    Join Date
    Oct 2005
    Posts
    1,115
    You could easily use "tar -cf <name-of-tar> <things-to-backup> to gather all thath needs to be backed up.

    From the other hand you could rsync to a disk or another server. For example, I have a script to backup to my USB-drive. The script is not entirely finished but it works.
    It only adds/deletes/updates files depending on what has happened with a file.

    For the reference, if you can do anything with it (I'm not a good scripter ):

    #!/bin/bash
    DRIVE_SERIAL="<serialnumber-of-the-usb-drive"
    DETECTION=`cat /proc/bus/usb/devices | grep SerialNumber=$DRIVE_SERIAL`
    LOGFILE=/var/scripts/backup.log
    RSYNC_TIMESTAMP=`date "+&#37;d%m%y"`
    RSYNC_LOGFILE="/var/scripts/rsync_$RSYNC_TIMESTAMP.log"
    BUSYFILE=/var/scripts/backup.busy

    if [ "$DETECTION" == "" ]; then
    echo "`date "+%b %d %H:%m:%S"` - USB-drive not attached. Exit." >> $LOGFILE
    else
    echo "`date "+%b %d %H:%m:%S"` - USB-drive found !" >> $LOGFILE
    echo "`date "+%b %d %H:%m:%S"` - Checking for running jobs ..." >> $LOGFILE
    if [ -f "$BUSYFILE" ]; then
    echo "`date "+%b %d %H:%m:%S"` - Busy-file found !" >> $LOGFILE
    echo "`date "+%b %d %H:%m:%S"` - Another backup already in progress. Exit." >> $LOGFILE
    exit
    else
    echo "`date "+%b %d %H:%m:%S"` - Busy-file not found. Good. Proceeding to backup." >> $LOGFILE
    echo "1" >> $BUSYFILE

    echo "`date "+%b %d %H:%m:%S"` - Mounting USB-drive ..." >> $LOGFILE
    mount -t ntfs-3g /dev/sdc1 /mnt/backup

    echo "`date "+%b %d %H:%m:%S"` - RSYNC Started." >> $LOGFILE
    rsync -vrlptg --log-file=$RSYNC_LOGFILE /xen/ /mnt/backup/Backup/xen
    rsync -vrlptg --log-file=$RSYNC_LOGFILE /raid3/ /mnt/backup/Backup/data
    echo "`date "+%b %d %H:%m:%S"` - RSYNC Finished." >> $LOGFILE

    echo "`date "+%b %d %H:%m:%S"` - Unmounting drives ..." >> $LOGFILE
    umount /dev/sdc1

    echo "`date "+%b %d %H:%m:%S"` - Releasing BACKUP_BUSY variable ..." >> $LOGFILE
    rm $BUSYFILE
    fi
    fi
    Last edited by Raiden; June 11th, 2009 at 03:39 PM.

  9. #9
    Member
    Join Date
    May 2005
    Location
    waraynon.com
    Posts
    93

    Thumbs up

    thanks for the tip. always been helpful. i'll make use of this script and perhaps expand to what i know. thank you.
    .sig na ture.

Similar Threads

  1. Windows Error Messages
    By cheyenne1212 in forum Miscellaneous Security Discussions
    Replies: 7
    Last Post: February 1st, 2012, 02:51 PM
  2. Replies: 0
    Last Post: August 3rd, 2004, 05:32 PM
  3. Central Secure Logging in a Win2k Environment
    By Tiger Shark in forum The Security Tutorials Forum
    Replies: 5
    Last Post: March 4th, 2004, 05:00 PM
  4. Heads Up - Cumulative Patch for Microsoft SQL Server (815495)
    By CXGJarrod in forum Microsoft Security Discussions
    Replies: 0
    Last Post: July 23rd, 2003, 10:00 PM
  5. Newbies, list of many words definitions.
    By -DaRK-RaiDeR- in forum Newbie Security Questions
    Replies: 9
    Last Post: December 14th, 2002, 08:38 PM

Tags for this Thread

Posting Permissions

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