
9th May 2010, 18:27
|
|
Member
|
|
Join Date: Jul 2008
Posts: 67
Thanks: 1
Thanked 33 Times in 4 Posts
|
|
Quote:
Originally Posted by dipeshmehta
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
|

13th May 2010, 14:07
|
|
Senior Member
|
|
Join Date: Nov 2008
Location: Rajkot, India
Posts: 173
Thanks: 5
Thanked 12 Times in 12 Posts
|
|
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
|

25th May 2010, 19:57
|
|
Member
|
|
Join Date: Jul 2008
Posts: 67
Thanks: 1
Thanked 33 Times in 4 Posts
|
|
Quote:
Originally Posted by dipeshmehta
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.
|

30th May 2010, 15:05
|
|
Junior Member
|
|
Join Date: Apr 2010
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

30th May 2010, 18:55
|
|
Member
|
|
Join Date: Jul 2008
Posts: 67
Thanks: 1
Thanked 33 Times in 4 Posts
|
|
Quote:
Originally Posted by Torch_za
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"
|

30th May 2010, 19:19
|
|
Junior Member
|
|
Join Date: Apr 2010
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

30th May 2010, 21:19
|
|
Member
|
|
Join Date: Jul 2008
Posts: 67
Thanks: 1
Thanked 33 Times in 4 Posts
|
|
Quote:
Originally Posted by Torch_za
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.
|

30th May 2010, 21:42
|
|
Junior Member
|
|
Join Date: Apr 2010
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
}
|

31st May 2010, 17:36
|
|
HowtoForge Supporter
|
|
Join Date: Apr 2009
Posts: 167
Thanks: 25
Thanked 2 Times in 2 Posts
|
|
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
|

31st May 2010, 18:09
|
|
Junior Member
|
|
Join Date: Apr 2010
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
cron
Quote:
Originally Posted by nokia80
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:
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
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT +2. The time now is 14:01.
|
|
Recent comments
14 hours 8 min ago
14 hours 14 min ago
19 hours 12 min ago
1 day 1 hour ago
1 day 2 hours ago
1 day 3 hours ago
1 day 8 hours ago
1 day 14 hours ago
1 day 18 hours ago
1 day 20 hours ago