title: Shell Script to make Centos Backup
body: <p>I read in a tutorial that I could use the following command to make a full backup of my CENTOS system:</p>
  
  <pre><code>tar cvpzf /backups/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backups --exclude=/dev --exclude=/sys --exclude=/boot/grub --exclude=/etc/fstab --exclude=/etc/sysconfig/network-scripts/ --exclude=/etc/udev/rules.d/70-persistent-net.rules /
  </code></pre>
  
  <p>That works great for me in the command line. I have tested it and the recovery went well. I would like to be able for this to happen automatically each night, but when I try to do it in a bash script it gives me some error messages. I know how to make a cron job to execute a shell script, but this code is not working to make the backup:</p>
  
  <pre><code>#!/bin/bash
  #Generic Server Backup With tar
  SERVER=`uname -n`
  echo "Starting backup for $SERVER..."
  tar cvpzf /home/backups/backup.tgz --exclude=/proc --exclude=/lost+found --exclude=/backups --exclude=/dev --exclude=/sys --exclude=/boot/grub --exclude=/etc/fstab --exclude=/etc/sysconfig/network-scripts/ --exclude=/etc/udev/rules.d/70-persistent-net.rules /
  echo "Done."
  </code></pre>
  
  <p>Anyone out there know what I'm doing wrong or how I can fix it?</p>
  
  <p>The error messages:</p>
  
  <pre><code>  sh bu.sh
  ...rting backup for juice.myserver.com
  tar: Removing leading `/' from member names
  tar: /\r: Cannot stat: No such file or directory
  tar: Error exit delayed from previous errors
  Done.
  </code></pre>