Share your knowledge at the LQ Wiki.
Go Back > Forums > Enterprise Linux Forums > Linux - Enterprise
User Name
Linux - Enterprise This forum is for all items relating to using Linux in the Enterprise.


  Search this Thread
Old 06-03-2005, 11:54 PM   #1
Registered: Mar 2005
Posts: 54

Rep: Reputation: 15
Backing Up Server

Hello everyone,

My company has several servers and we want to backup the production web servers to a dedicated server box. I have written a backupscript that I wanted to use but I got a slew of errors. Here is the script:


TODAY=\"date +%D\"
TODAY2=\"date +%m%d%Y\"

mysqldump -u $MYSQLUSR -p $MYSQLPSD $DB > $FILE_$TODAY2
rkhunter -c > $RKH_$TODAY2
cd /root/chkrootkit-0.45/
./chkrootkit > $BACKDIR/$CHK_$TODAY2

tar czf $FILE_temp_$TODAY2.tar.gz $FILE_$TODAY2 $RKH_$TODAY2 $CHK_TODAY2 /home | gpg -c > $FILE_$TODAY2.tar.gz
rm $FILE_temp_$TODAY2.tar.gz

date | mutt -s \"$FILE ($TODAY) \" -a $FILE_$TODAY2.tar.gz $EMAIL

When I run the script, using ./ I get the following set of errors:

[root@localhost ~]# ./
./ line 3: +%D": command not found
./ line 4: +%m%d%Y": command not found
./ line 14: cd: "/root/backup": No such file or directory
./ line 15: $FILE_$TODAY2: ambiguous redirect
./ line 16: $RKH_$TODAY2: ambiguous redirect
./ line 18: "/root/backup"/: No such file or directory
./ line 19: cd: "/root/backup": No such file or directory
gpg: failed to create temporary file `/root/.gnupg/.#lk0x552ac57250.localhost.lo
caldomain.16254': No such file or directory
gpg: keyblock resource `/root/.gnupg/pubring.gpg': general error
Enter passphrase: tar: Removing leading `/' from member names
gpg: can't create `/root/.gnupg/random_seed': No such file or directory
rm: too few arguments
Try `rm --help' for more information.
rm: too few arguments
Try `rm --help' for more information.
rm: too few arguments
Try `rm --help' for more information.
[root@localhost ~]# ls

What I am trying to do is to run Rkhunter and Chkrootkit and give them their own text file. Then make a mysql backup and a backup of the home directory. All these files get tarred then encrypted. All files that were used prior are then deleted.

Can someone please tell me what I did wrong? Any help will be greatly appreciated.
Old 06-04-2005, 04:46 PM   #2
LQ Newbie
Registered: Dec 2004
Posts: 25

Rep: Reputation: 15
TODAY=\"date +%D\"

you need backticks there to execute the date command.

take the backslash out from the quotes, for the varaibles that you just want to assign strings to.

also consider rsync for backups, and see:

hope this helps you get started with shell programming!



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
File Server vs. Backing up date fredmt Linux - General 7 11-02-2005 08:11 AM
Backing Up Server stlyz3 Linux - Software 4 06-04-2005 10:44 PM
Backing up a Slackware server technician Slackware 3 03-09-2005 01:50 PM
Backing up of a RH8 server without root axx p0 theed Linux - Networking 27 07-07-2003 02:38 PM
Backing up Linux to a remote server! DigiCrime Linux - General 5 12-10-2002 03:41 AM > Forums > Enterprise Linux Forums > Linux - Enterprise

All times are GMT -5. The time now is 01:44 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration