View Single Post
Old 9th May 2010, 18:27
go0ogl3 go0ogl3 is offline
Join Date: Jul 2008
Posts: 69
Thanks: 4
Thanked 38 Times in 6 Posts

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
line 238(or 273): [: -gt: unary operator expected
might be due to wrong information store in
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.


Thanks for pointing this out. The computer variable can be set like this:
The implicit setting for me is:
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