computer variable for computer at hosted server company, can't runbackup script

This is a discussion on computer variable for computer at hosted server company, can't runbackup script within the shell forums in Operating Systems category; I'm trying to get the backup script below to run on our dedicated hosted server. I don't know what the computer variable is supposed to be on line 5? The server name with the hosting company is sf6h31. I also have a domain name and a root name allrail . I tried the sf6h31 and the allrail as well as the domain name for the computer variable separately and I get the same error. I also tried allrail-at-mydomainname. If this script needs the computer name is there a linux command to get it? I tried whoami and it ...

Go Back   Database Forum > Operating Systems > shell

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-27-2008, 05:24 PM
Default computer variable for computer at hosted server company, can't runbackup script

I'm trying to get the backup script below to run on our dedicated
hosted server. I don't know what the computer variable is supposed to
be on line 5? The server name with the hosting company is sf6h31. I
also have a domain name and a root name "allrail". I tried the sf6h31
and the allrail as well as the domain name for the computer variable
separately and I get the same error. I also tried
allrail-at-mydomainname. If this script needs the computer name is there
a linux command to get it? I tried whoami and it said allrail but
allrail doesn't work. I get these other error messages concerning
other directories. The script is located in ~/bin/
Can you tell me how to fix the errors? Also what do I do for the --
exclude command? Is -- a comment?

tia,
Janis

-------------
allrail-at-mydomainname.com[~/bin]
backup_web.txt: line 5: sf6h31: command not found
backup_web.txt: line 6: ../public_html/: is a directory
backup_web.txt: line 7: /home/allrail/bin: is a directory
backup_web.txt: line 8: /home/allrail/bin/time_of_last_backup: is a
directory
backup_web.txt: line 9: /home/allrail/bin/tar: No such file or
directory
cat: /-full-date: No such file or directory
backup_web.txt: line 53: --newer: command not found
backup_web.txt: line 54: --exclude=: command not found
allrail-at-mydomainname.com [~/bin]#

-------backup script---------


#!/bin/sh
# full and incremental backup script
#Change the 5 variables below to fit your computer/backup

COMPUTER= sf6h31
DIRECTORIES= ../public_html/ # directories to backup
BACKUPDIR= ~/bin # where to store the backups
TIMEDIR= ~/bin/time_of_last_backup #time of last backup
TAR= ~/bin/tar # name and locaction of tar

#You should not have to change anything below here

PATH=/usr/local/bin:/usr/bin:/bin
DOW=`date +%a` # Day of the week e.g. Mon
DOM=`date +%d` # Date of the Month e.g. 27
DM=`date +%d%b` # Date and Month e.g. 27Sep

# On the 1st of the month a permanent full backup is made
# Every Sunday a full backup is made - overwriting last Sundays backup
# The rest of the time an incremental backup is made. Each incremental
# backup overwrites last weeks incremental backup of the same name.
#
# if NEWER = "", then tar backs up all files in the directories
# otherwise it backs up files newer than the NEWER date. NEWER
# gets it date from the file written every Sunday.


# Monthly full backup
if [ $DOM = "01" ]; then
cd /
NEWER=""
$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DM.tar $DIRECTORIES
--exclude="$BACKUPDIR"
fi

# Weekly full backup
if [ $DOW = "Sun" ]; then
cd /
NEWER=""
NOW=`date +%d-%b`

# Update full backup date
echo $NOW > $TIMEDIR/$COMPUTER-full-date
$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
--exclude="$BACKUPDIR"

# Make incremental backup - overwrite last weeks
else

# Get date of last full backup
NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"
cd /
$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
--exclude="$BACKUPDIR"
fi


Reply With Quote
  #2  
Old 08-27-2008, 05:30 PM
Default Re: computer variable for computer at hosted server company, can't run backup script

On Wednesday 27 August 2008 22:24, JRough wrote:

> I'm trying to get the backup script below to run on our dedicated
> hosted server. I don't know what the computer variable is supposed to
> be on line 5? The server name with the hosting company is sf6h31. I
> also have a domain name and a root name "allrail". I tried the sf6h31
> and the allrail as well as the domain name for the computer variable
> separately and I get the same error. I also tried
> allrail-at-mydomainname. If this script needs the computer name is there
> a linux command to get it? I tried whoami and it said allrail but
> allrail doesn't work. I get these other error messages concerning
> other directories. The script is located in ~/bin/
> Can you tell me how to fix the errors? Also what do I do for the --
> exclude command? Is -- a comment?


The syntax for variable assignment is

variable=value

with no spaces. Change all your assignments, eg

COMPUTER= sf6h31
should become
COMPUTER=sf6h31

DIRECTORIES= ../public_html/
should become
DIRECTORIES=../public_html/

etc.

--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
Reply With Quote
  #3  
Old 08-27-2008, 05:35 PM
Default Re: computer variable for computer at hosted server company, can'trun backup script

Thus spake JRough (jlrough-at-yahoo.com):
> I'm trying to get the backup script below to run on our dedicated
> hosted server. I don't know what the computer variable is supposed to
> be on line 5? The server name with the hosting company is sf6h31. I
> also have a domain name and a root name "allrail". I tried the sf6h31
> and the allrail as well as the domain name for the computer variable
> separately and I get the same error. I also tried
> allrail-at-mydomainname. If this script needs the computer name is there
> a linux command to get it? I tried whoami and it said allrail but
> allrail doesn't work. I get these other error messages concerning
> other directories. The script is located in ~/bin/
> Can you tell me how to fix the errors? Also what do I do for the --
> exclude command? Is -- a comment?

[...]
> allrail-at-mydomainname.com[~/bin]
> backup_web.txt: line 5: sf6h31: command not found
> backup_web.txt: line 6: ../public_html/: is a directory
> backup_web.txt: line 7: /home/allrail/bin: is a directory
> backup_web.txt: line 8: /home/allrail/bin/time_of_last_backup: is a
> directory
> backup_web.txt: line 9: /home/allrail/bin/tar: No such file or
> directory
> cat: /-full-date: No such file or directory
> backup_web.txt: line 53: --newer: command not found
> backup_web.txt: line 54: --exclude=: command not found
> allrail-at-mydomainname.com [~/bin]#

[...]
> COMPUTER= sf6h31
> DIRECTORIES= ../public_html/ # directories to backup
> BACKUPDIR= ~/bin # where to store the backups
> TIMEDIR= ~/bin/time_of_last_backup #time of last backup
> TAR= ~/bin/tar # name and locaction of tar


COMPUTER="sf6h31"
DIRECTORIES="../public_html/"
... and so on..
--
{ \|/ ______ \|/ Access denieded | Christian 'strcat' Schneider }
{ "@' / , . \ `@" Nah Nah Nah | http://www.strcat.de/ }
{ /__| \____/ |__\ | http://www.strcat.de/blog/ }
{ \___U__/ | http://strcat.de/chris.gpg }
Reply With Quote
  #4  
Old 08-27-2008, 07:39 PM
Default Re: computer variable for computer at hosted server company, can'trun backup script

On Aug 27, 1:30*pm, pk wrote:
> On Wednesday 27 August 2008 22:24, JRough wrote:
>
> > I'm trying to get the backup script below to run on our dedicated
> > hosted server. *I don't know what the computer variable is supposed to
> > be on line 5? *The server name with the hosting company is sf6h31. I
> > also have a domain name and a root name "allrail". *I tried the sf6h31
> > and the allrail as well as the domain name for the computer variable
> > separately and I get the same error. I also tried
> > allrail-at-mydomainname. If this script needs the computer name is there
> > a linux command to get it? I tried whoami and it said allrail but
> > allrail doesn't work. I get these other error messages concerning
> > other directories. *The script is located in ~/bin/


Hi, thanks it is much better. There is one problem left. There is an
error on line 53 and 54 which is the last 2 lines before the final fi:

$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
--exclude="$BACKUPDIR"
What is the --exclude for? Is that a comment?
----errror message------
allrail-at-mydomainname.com [~/bin]# !sh
sh backup_web.txt
cat: /home/allrail/bin/allrail-full-date: No such file or directory
backup_web.txt: line 53: /home/allrail/bin: is a directory
backup_web.txt: line 54: --exclude=/home/allrail/bin/backups: No such
file or directory
allrail-at-mydomainname.com [~/bin]#

----------------changed script---------------
#!/bin/sh
# full and incremental backup script
#Change the 5 variables below to fit your computer/backup

COMPUTER=allrail
DIRECTORIES=../public_html # directories to backup
BACKUPDIR=~/bin/backups # where to store the backups
TIMEDIR=~/bin #time of last backup
TAR=~/bin # name and locaction of tar

#You should not have to change anything below here

PATH=/usr/local/bin:/usr/bin:/bin
DOW=`date +%a` # Day of the week e.g. Mon
DOM=`date +%d` # Date of the Month e.g. 27
DM=`date +%d%b` # Date and Month e.g. 27Sep

# On the 1st of the month a permanent full backup is made
# Every Sunday a full backup is made - overwriting last Sundays backup
# The rest of the time an incremental backup is made. Each incremental
# backup overwrites last weeks incremental backup of the same name.
#
# if NEWER = "", then tar backs up all files in the directories
# otherwise it backs up files newer than the NEWER date. NEWER
# gets it date from the file written every Sunday.


# Monthly full backup
if [ $DOM = "01" ]; then
cd /
NEWER=""
$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DM.tar $DIRECTORIES
--exclude="$BACKUPDIR"
fi

# Weekly full backup
if [ $DOW = "Sun" ]; then
cd /
NEWER=""
NOW=`date +%d-%b`

# Update full backup date
echo $NOW > $TIMEDIR/$COMPUTER-full-date
$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
--exclude="$BACKUPDIR"

# Make incremental backup - overwrite last weeks
else

# Get date of last full backup
NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"
cd /
$TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
--exclude="$BACKUPDIR"
fi


thanks very much
Reply With Quote
  #5  
Old 08-28-2008, 02:36 AM
Default Re: computer variable for computer at hosted server company, can't run backup script

In article
<7af8d8ef-dca6-4623-8d4b-0c4460412e34@p10g2000prf.googlegroups.com>,
JRough wrote:

> On Aug 27, 1:30*pm, pk wrote:
> > On Wednesday 27 August 2008 22:24, JRough wrote:
> >
> > > I'm trying to get the backup script below to run on our dedicated
> > > hosted server. *I don't know what the computer variable is supposed to
> > > be on line 5? *The server name with the hosting company is sf6h31. I
> > > also have a domain name and a root name "allrail". *I tried the sf6h31
> > > and the allrail as well as the domain name for the computer variable
> > > separately and I get the same error. I also tried
> > > allrail-at-mydomainname. If this script needs the computer name is there
> > > a linux command to get it? I tried whoami and it said allrail but
> > > allrail doesn't work. I get these other error messages concerning
> > > other directories. *The script is located in ~/bin/

>
> Hi, thanks it is much better. There is one problem left. There is an
> error on line 53 and 54 which is the last 2 lines before the final fi:
>
> $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
> --exclude="$BACKUPDIR"
> What is the --exclude for? Is that a comment?


No, it's part of the tar command, it tells it to exclude certain items
from the archive. But I think it needs to be put BEFORE the list of
directories to archive.

Also, make sure it's actually on the same line as $TAR, not the next
line. It's hard to tell whether the line break in your post was
actually in the script or just due to wrapping in your newsreader.

> ----errror message------
> allrail-at-mydomainname.com [~/bin]# !sh
> sh backup_web.txt
> cat: /home/allrail/bin/allrail-full-date: No such file or directory
> backup_web.txt: line 53: /home/allrail/bin: is a directory
> backup_web.txt: line 54: --exclude=/home/allrail/bin/backups: No such
> file or directory
> allrail-at-mydomainname.com [~/bin]#
>
> ----------------changed script---------------
> #!/bin/sh
> # full and incremental backup script
> #Change the 5 variables below to fit your computer/backup
>
> COMPUTER=allrail
> DIRECTORIES=../public_html # directories to backup
> BACKUPDIR=~/bin/backups # where to store the backups
> TIMEDIR=~/bin #time of last backup
> TAR=~/bin # name and locaction of tar
>
> #You should not have to change anything below here
>
> PATH=/usr/local/bin:/usr/bin:/bin
> DOW=`date +%a` # Day of the week e.g. Mon
> DOM=`date +%d` # Date of the Month e.g. 27
> DM=`date +%d%b` # Date and Month e.g. 27Sep
>
> # On the 1st of the month a permanent full backup is made
> # Every Sunday a full backup is made - overwriting last Sundays backup
> # The rest of the time an incremental backup is made. Each incremental
> # backup overwrites last weeks incremental backup of the same name.
> #
> # if NEWER = "", then tar backs up all files in the directories
> # otherwise it backs up files newer than the NEWER date. NEWER
> # gets it date from the file written every Sunday.
>
>
> # Monthly full backup
> if [ $DOM = "01" ]; then
> cd /
> NEWER=""
> $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DM.tar $DIRECTORIES
> --exclude="$BACKUPDIR"
> fi
>
> # Weekly full backup
> if [ $DOW = "Sun" ]; then
> cd /
> NEWER=""
> NOW=`date +%d-%b`
>
> # Update full backup date
> echo $NOW > $TIMEDIR/$COMPUTER-full-date
> $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
> --exclude="$BACKUPDIR"
>
> # Make incremental backup - overwrite last weeks
> else
>
> # Get date of last full backup
> NEWER="--newer `cat $TIMEDIR/$COMPUTER-full-date`"
> cd /
> $TAR $NEWER -cf $BACKUPDIR/$COMPUTER-$DOW.tar $DIRECTORIES
> --exclude="$BACKUPDIR"
> fi
>
>
> thanks very much


--
Barry Margolin, barmar-at-alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 02:09 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.