Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Plugins/Modules/Addons

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #21  
Old 13th February 2010, 14:35
bseibenick bseibenick is offline
HowtoForge Supporter
 
Join Date: Dec 2009
Posts: 17
Thanks: 3
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by go0ogl3 View Post
I hope I'll have some time in this weekend to improve the script. I'm downloading CentOS and I will test the script to see what I'm missing. I think it must be something related to the bash settings used.

Thank you for your time.
Thank you for a great script!
Reply With Quote
Sponsored Links
  #22  
Old 25th February 2010, 11:18
dipeshmehta dipeshmehta is offline
Senior Member
 
Join Date: Nov 2008
Location: Rajkot, India
Posts: 173
Thanks: 5
Thanked 13 Times in 13 Posts
Send a message via Yahoo to dipeshmehta Send a message via Skype™ to dipeshmehta
Default

Hello all,

I get
Code:
line 238: [: -gt: unary operator expected
whre the code is
Code:
function check_space {
    #pfs=$(($pfs-1)) # for test
    pfs=`df -h $BACKUPDIR | awk 'NR==2{print $5}' | cut -d% -f 1`
    #pfs="90"

    if [ $pfs -gt $maxp ] ;then
	log "There is $pfs% space used on $BACKUPDIR"
	    if [ $del_en = "yes" ] ; then
and
Code:
line 292: -cjpSPf: command not found
where the code is
Code:
if [ -z $fb ] ; then
	    log "No full backup found for $YX. Full backup now!"
	    echo > $tmpdir/full-backup$XX.lck
	    $TAR $ARG $BACKUPDIR/full$XX-$FDATE.tar.bz2 $YX -X $tmpdir/excluded
	    log "Backup of $YX done."
	fi
I have been using Ubuntu 8.04 Server.

Please help me to get rid of the situation.

Thanks in advance.

Dipesh
Reply With Quote
  #23  
Old 6th March 2010, 21:21
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Exclamation

Quote:
Originally Posted by dipeshmehta View Post
Hello all,

I get
Code:
line 238: [: -gt: unary operator expected
whre the code is
Code:
function check_space {
    #pfs=$(($pfs-1)) # for test
    pfs=`df -h $BACKUPDIR | awk 'NR==2{print $5}' | cut -d% -f 1`
    #pfs="90"

    if [ $pfs -gt $maxp ] ;then
	log "There is $pfs% space used on $BACKUPDIR"
	    if [ $del_en = "yes" ] ; then
and
Code:
line 292: -cjpSPf: command not found
where the code is
Code:
if [ -z $fb ] ; then
	    log "No full backup found for $YX. Full backup now!"
	    echo > $tmpdir/full-backup$XX.lck
	    $TAR $ARG $BACKUPDIR/full$XX-$FDATE.tar.bz2 $YX -X $tmpdir/excluded
	    log "Backup of $YX done."
	fi
I have been using Ubuntu 8.04 Server.

Please help me to get rid of the situation.

Thanks in advance.

Dipesh
Hello, the first error is because the space check fails, one of the $pfs or $maxp parameters is not a number. This is a non fatal error so you can ignore it. Maybe will be corected in a future version of the script, or you can adapt the function to check the free space corectly for your situation...

The second error occurs only if you don't have "tar" installed on your linux, or you don't have "which" command or the "tar" is not in your PATH and is given because the $TAR on the 292 line is NULL. "TAR" is defined in the header of the script by default with TAR=`which tar` on line 111.

So to get rid of the situation you must check the free space problem if you care about that and most important, you must resolve the "tar" problem. If "tar" isn't in your PATH please define the "TAR=" with the path to the tar binary.

For more problems, ask here, I'll try to respond ASAP.
Reply With Quote
  #24  
Old 7th March 2010, 00:36
andypl andypl is offline
Member
 
Join Date: Mar 2006
Location: Radom, Poland
Posts: 93
Thanks: 1
Thanked 1 Time in 1 Post
Default

At the outset thanks for the nice script.
There is one problem ... me restore everything was full and incremental archive and what if the customer specifically totaled some directories and files? if the script can somehow delete the deleted files or directories?
Reply With Quote
  #25  
Old 7th March 2010, 23:17
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Lightbulb More info about restore

Quote:
Originally Posted by andypl View Post
At the outset thanks for the nice script.
There is one problem ... me restore everything was full and incremental archive and what if the customer specifically totaled some directories and files? if the script can somehow delete the deleted files or directories?
The script is unpacking all files to the date requested then is asking you if you want to delete the files created right after the restore date. You see a list of all the files or dir's which will be deleted. If you answer "yes" all files and directories created after the requested restore day are deleted. You can answer no and delete the files or dir's using what pattern you like, after the scripts unpacks all incremental archives.

You can try the restore part of the script and I recomend everybody to test this part but not directly on /. Use the tmp dir for example. If it's a full linux system you can chroot if you want and test your system before actual restoration.

Have a nice day!
Reply With Quote
  #26  
Old 18th April 2010, 09:20
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Thumbs up New version: back-res 0.9.2

I've managed to improve this script a little, so here is a new version.

Fixes:
- First run now does not gives errors
- Modified the log function to accept first time dir createin
- Modified the starting sequence to not check the free space if the primary backup directory does not exist
- If primary backup dir does not exist now it's created at the start
- Added a line to remove the maildata at the start if the user stops the script before finishing his jobs. This prevents the script to send incorect mails.
- Added link http://www.howtoforge.com/forums/showthread.php?t=41609
- Added first TODO

Thanks goes to nokia80, Snake12, rudolfpietersma, HyperAtom, jmp51483, bseibenick, dipeshmehta, andypl and others

Allways download the latest version here: http://www.eurosistems.ro/back-res
Old version: http://www.eurosistems.ro/back-res.0.9.1
Reply With Quote
The Following 2 Users Say Thank You to go0ogl3 For This Useful Post:
dipeshmehta (9th May 2010), falko (19th April 2010)
  #27  
Old 20th April 2010, 16:02
skoena skoena is offline
Senior Member
 
Join Date: Sep 2009
Location: Emmen, Netherlands
Posts: 421
Thanks: 77
Thanked 13 Times in 11 Posts
Send a message via MSN to skoena Send a message via Skype™ to skoena
Default

Hi there,
Is it a possibility to make it a remote backup script like this and then combine them together? I'm really looking for a good/perfect script with remote backup.

http://howtoforge.com/forums/showthr...ewpost&t=38258

Rudolf.
Reply With Quote
  #28  
Old 21st April 2010, 21:18
Toucan Toucan is offline
Senior Member
 
Join Date: Dec 2009
Posts: 479
Thanks: 78
Thanked 39 Times in 33 Posts
Default

I really like the idea of this script and would love to use it. I'm a little confused about the user variables. Is there a sample used by someone else i could see please.

I'm using debian lenny.

This is what I tried:

Code:
COMPUTER=`cat /etc/badbuntu | awk 'NR==1{print $1}'`    # name of this computer
DIRECTORIES="/adm /bin /boot /etc /home /lib /root
/sbin /usr /var"                                        # directories to backup
EXCLUDED="/bck /tmp /dev /proc /sys /media
/var/adm /var/cache /var/lib/mysql
/var/run /var/lock /lib/init/rw /var/tmp
/var/log/verlihub /var/lib/amavis /var/spool/postfix/p*
/var/spool/postfix/var *.pid *.lock *.lck"              # exclude those dir's and files
BACKUPDIR="/mnt/badback/back/$COMPUTER"                   # where to store the backups
dbuser="root"                                           # database user
dbpassword="mysqlpass"                                # database password
email="admin@gohoti.com"                             # mail for the responsible person
TAR=`backuptar`                                         # name and location of tar
ARG="-cjpSPf"           #sparse                         # tar arguments P = removed /
EARG="-xjpf"                                            # tar extract arguments P = removed /
tmpdir="/tmp/tmpbck"                                    # temp dir for database dump and other stuff
del_en="yes"                                            # Enable delete of files if used space percent > than $maxp (yes or anything else)
maxp="85"                                               # Max percent of used space before start of delete
hm="2359"                                               # last minute of the day = last minute of the restored backup of the day restored
I tried running it with:
./back-res

and got this result:
Code:
badbuntu:/# ./back-res
cat: /etc/badbuntu: No such file or directory
./back-res: line 141: backuptar: command not found
./back-res: line 272: [: -gt: unary operator expected
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 298: -cjpSPf: command not found
./back-res: line 332: -cjpSPf: command not found
./back-res: line 332: -cjpSPf: command not found
./back-res: line 332: -cjpSPf: command not found
./back-res: line 332: -cjpSPf: command not found
./back-res: line 332: -cjpSPf: command not found
./back-res: line 332: -cjpSPf: command not found
./back-res: line 332: -cjpSPf: command not found
./back-res: line 332: -cjpSPf: command not found
./back-res: line 332: -cjpSPf: command not found
./back-res: line 332: -cjpSPf: command not found
badbuntu:/#
Any help much appreciated

Last edited by Toucan; 21st April 2010 at 21:44.
Reply With Quote
  #29  
Old 22nd April 2010, 16:20
SimonH SimonH is offline
Junior Member
 
Join Date: Nov 2008
Posts: 11
Thanks: 0
Thanked 1 Time in 1 Post
Default

Quote:
Originally Posted by Toucan View Post
./back-res: line 141: backuptar: command not found
./back-res: line 272: [: -gt: unary operator expected
Quote:
TAR=`backuptar`
that line in your script should probably just be

Code:
TAR=`which tar`
Great script by the way go0ogl3, works perfectly for me, I just need to tag an scp command on the end now to send the backup to a remote box.

Nice job
Reply With Quote
The Following User Says Thank You to SimonH For This Useful Post:
Toucan (25th April 2010)
  #30  
Old 25th April 2010, 21:20
Toucan Toucan is offline
Senior Member
 
Join Date: Dec 2009
Posts: 479
Thanks: 78
Thanked 39 Times in 33 Posts
 
Default

Quote:
Originally Posted by SimonH View Post
that line in your script should probably just be

Code:
TAR=`which tar`
Great script by the way go0ogl3, works perfectly for me, I just need to tag an scp command on the end now to send the backup to a remote box.

Nice job
Thanks Simon. Works great now thanks.

For the benefit of others who are at my level of learning, using this line:

Code:
40 3 * * * /etc/back-res 1>/dev/null 2>/dev/null
in the crontab will send all output into the 'bit bin'. That means where there were problems such as trying to backup a non existent directory it'll carry on with no offputting error messages to the user. It'll just run during the night with a nice surprise for the morning.

In debian lenny you can find the crontab: /etc/crontab then use your favourite editor to add that line.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
freebsd 7, samba 3, domain controller alexdimarco Suggest HOWTO 6 5th November 2010 16:54
how to restore Ispconfig from backup db na0lb Installation/Configuration 4 24th September 2008 08:51
Restore backup ISPConfig leeeonardo General 4 18th April 2007 20:21
Restore ispconfig complete backup statiic General 1 15th January 2007 10:32
Backup restore on ispconfig misterm Installation/Configuration 0 18th December 2005 23:32


All times are GMT +2. The time now is 12:39.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.