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
  #41  
Old 9th May 2010, 18:27
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Lightbulb

Quote:
Originally Posted by dipeshmehta View Post
Sorry go0ogl3, after your making available the improved script, I couldn't get enough time to check it. Today, I checked and as expected it works like a charm. Thanks for the great work done.

Moreover, I came to know one point that the error
Code:
line 238(or 273): [: -gt: unary operator expected
might be due to wrong information store in
Code:
COMPUTER=`cat /etc/HOSTNAME | awk 'NR==1{print $1}'`
variable. As I have been using ubuntu, my hostname store in /etc/hostname (not /etc/HOSTNAME). If $COMPUTER variable has wrong data or empty, then $BACKUPDIR will point wrong, recursively pfs=`df -h $BACKUPDIR | awk 'NR==2{print $5}' | cut -d% -f 1` shall also have wrong data, giving error on line 238 (or 273).

Those who get such error, check COMPUTER=`cat /etc/HOSTNAME | awk 'NR==1{print $1}'` line and alter according to your distro.

Thanks once again go0ogl3, this is exactly what I wanted for backup solution.

Dipesh

Thanks for pointing this out. The computer variable can be set like this:
Code:
COMPUTER="www.site.com"
The implicit setting for me is:
Code:
COMPUTER=`cat /etc/HOSTNAME | awk 'NR==1{print $1}'`
just because I use mainly Slackware for many servers and the hostname file is /etc/HOSTNAME.
The first version of the script was from a Ubuntu server so it uses /etc/hostname.

Hope this helps!

Last edited by go0ogl3; 9th May 2010 at 18:28. Reason: typos
Reply With Quote
Sponsored Links
  #42  
Old 13th May 2010, 14:07
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,

Although the script is working fine, I have some problem backing up few home folders. Some of users' home folders' have '_' in their names. It has been clearly mentioned in the headers of the script that, '...Weird things can happen if your backup dirs includes the "-" or "_" chars.' I cannot change names of these folders now. If possible, please guide me to solve the problem.

Dipesh
Reply With Quote
  #43  
Old 25th May 2010, 19:57
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,

Although the script is working fine, I have some problem backing up few home folders. Some of users' home folders' have '_' in their names. It has been clearly mentioned in the headers of the script that, '...Weird things can happen if your backup dirs includes the "-" or "_" chars.' I cannot change names of these folders now. If possible, please guide me to solve the problem.

Dipesh
You have to replace those characters, which are "hardcoded" in the script. Begin reading the code with the line: "#Replace / with _ in dir name => filename" I hope you will understand what's going on. Choose another character to replace "/" and if it's a smarter choice write here so we can update the script to help other people too.

If you need more help write here. I'll read this forum more often these days to help you if you need.
Reply With Quote
  #44  
Old 30th May 2010, 15:05
Torch_za Torch_za is offline
Junior Member
 
Join Date: Apr 2010
Posts: 19
Thanks: 0
Thanked 2 Times in 2 Posts
Default No Mail on completion

When the backup runs via cron the code suggests an email is generated and sent to the 'responsible person'. Is it just me or does this not work? The backup runs - there are log file entries and tar files in the right place but no "Success" email. When I ran the code with a trace it looks like that line is never executed?

Using the latest script on 5 Debian ISPConfig3 servers.

Last edited by Torch_za; 30th May 2010 at 15:14.
Reply With Quote
  #45  
Old 30th May 2010, 18:55
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Default

Quote:
Originally Posted by Torch_za View Post
When the backup runs via cron the code suggests an email is generated and sent to the 'responsible person'. Is it just me or does this not work? The backup runs - there are log file entries and tar files in the right place but no "Success" email. When I ran the code with a trace it looks like that line is never executed?

Using the latest script on 5 Debian ISPConfig3 servers.
You have to check your mail command. There are 2 lines in the script which are used to send mail. Just search for "mail -s"
You can test if the mail command works using some test command:

mail -s "Subject" "mail@mailserver.com" < "datatext"
Reply With Quote
  #46  
Old 30th May 2010, 19:19
Torch_za Torch_za is offline
Junior Member
 
Join Date: Apr 2010
Posts: 19
Thanks: 0
Thanked 2 Times in 2 Posts
Default Not the problem ..

Mail on all servers runs just fine... it has to... they are production servers.

If I run the (modified - variables are substituted) line from a shell, it runs and the mail is sent. It's the back-res script that does not seem to fire the line...

The safe tail of the trace (set -x)


+ echo '2010-05-30 19:12:48 - back-res - Daily backup for /var done.'
+ rm -rf /backup/tmpbck/full-backup_var.lck
+ rm -rf /backup/tmpbck/excluded
+ log 'All backup jobs done. Exiting script!'
++ date '+%Y-%m-%d %H:%M:%S'
+ acum='2010-05-30 19:12:48'
+ '[' -e /backup/server.domain.tld/log/backup.log ']'
++ basename ./back-res
+ echo '2010-05-30 19:12:48 - back-res - All backup jobs done. Exiting script!'
++ basename ./back-res
+ echo '2010-05-30 19:12:48 - back-res - All backup jobs done. Exiting script!'
+ exit 1


As you can see the line is never reached or executed...

Last edited by Torch_za; 30th May 2010 at 19:52.
Reply With Quote
  #47  
Old 30th May 2010, 21:19
go0ogl3 go0ogl3 is offline
Member
 
Join Date: Jul 2008
Posts: 73
Thanks: 5
Thanked 39 Times in 6 Posts
Exclamation

Quote:
Originally Posted by Torch_za View Post
Mail on all servers runs just fine... it has to... they are production servers.

If I run the (modified - variables are substituted) line from a shell, it runs and the mail is sent. It's the back-res script that does not seem to fire the line...

The safe tail of the trace (set -x)


+ echo '2010-05-30 19:12:48 - back-res - Daily backup for /var done.'
+ rm -rf /backup/tmpbck/full-backup_var.lck
+ rm -rf /backup/tmpbck/excluded
+ log 'All backup jobs done. Exiting script!'
++ date '+%Y-%m-%d %H:%M:%S'
+ acum='2010-05-30 19:12:48'
+ '[' -e /backup/server.domain.tld/log/backup.log ']'
++ basename ./back-res
+ echo '2010-05-30 19:12:48 - back-res - All backup jobs done. Exiting script!'
++ basename ./back-res
+ echo '2010-05-30 19:12:48 - back-res - All backup jobs done. Exiting script!'
+ exit 1


As you can see the line is never reached or executed...

You are right, the line which sends mail is in the restore part of the script... So mail is send only at restore. My mistake. The backup part does not send mail. I'll correct this as soon as possible. Thanks for pointing this up.
Reply With Quote
  #48  
Old 30th May 2010, 21:42
Torch_za Torch_za is offline
Junior Member
 
Join Date: Apr 2010
Posts: 19
Thanks: 0
Thanked 2 Times in 2 Posts
Default Fix ....

change back-res line 356

#Clean temp dir
rm -rf $tmpdir/excluded
# End of script
log "All backup jobs done. Exiting script!"
}

#Clean temp dir
rm -rf $tmpdir/excluded
# End of script
log "All backup jobs done. Exiting script!"
mail -s "Daily backup of $COMPUTER `date +'%F'`" "$email" < $tmpdir/maildata
}
Reply With Quote
  #49  
Old 31st May 2010, 17:36
nokia80 nokia80 is offline
HowtoForge Supporter
 
Join Date: Apr 2009
Posts: 197
Thanks: 35
Thanked 2 Times in 2 Posts
Send a message via Skype™ to nokia80
Default

hello

can someone tell me how I setup cron job

I want to do this in ISPConfig, and then at night

with kind regards michael
Reply With Quote
  #50  
Old 31st May 2010, 18:09
Torch_za Torch_za is offline
Junior Member
 
Join Date: Apr 2010
Posts: 19
Thanks: 0
Thanked 2 Times in 2 Posts
 
Default cron

Quote:
Originally Posted by nokia80 View Post
hello

can someone tell me how I setup cron job

I want to do this in ISPConfig, and then at night

with kind regards michael
You don't say for what OS: Most Linux / Unix boxes will accept the following:

from the shell as root:
Code:
 crontab -e
then copy and paste:
Code:
30 1 * * *  /etc/back-res 1>/dev/null 2>/dev/null
which is
Code:
*     *     *   *    *        command to be executed
-     -     -   -    -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of        month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)
So at 30 minutes past 1 every day of the month run back-res sending output and error output to the bit bucket

To run a cronjob for hosted websites there is an option on the control panel -- sites .. cronjobs

Last edited by Torch_za; 31st May 2010 at 18:17. Reason: bad tags
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 09:15.


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