[lug] bash script functions

Jason Davis jd_480 at hotmail.com
Tue Nov 6 12:25:29 MST 2001


<br><br><br>  Jason Davis
   jd_480 at hotmail.com

the script does its job fine....the errors are trival errors...its trying to 
execute my echos as command the error syntax and script output are bellow 
the script
jd

>From: dan radom <dradom at redback.com>
>Reply-To: lug at lug.boulder.co.us
>To: lug at lug.boulder.co.us
>Subject: Re: [lug] bash script functions
>Date: Tue, 6 Nov 2001 12:06:34 -0700
>
>I'm guessing this script runs from cron or the like.  where specifically 
>are the errors?  are commands like smbmount in your $PATH?  if the script 
>can't find commands then it's most likely an environment error...and cron 
>doesn't know jack about your environment.
>
>dan
>
>* Jason Davis (jd_480 at hotmail.com) wrote:
> > hi,
> >
> > im runnina bash script to back up files. i use a function
> > that determines if the file i want to backup has been created for the 
>day
> > then responds accordingly...works but bash tries to interpert echos that
> > i do in the function as commands..giving me trival errors like command
> > does not exist. script below...(some stuff wraped by hotmail)
> >
> > #! /bin/bash
> > #
> > #
> > ########CONSTANTS
> > RICHARD1="-o username=xxxx"
> > ########FUNCTIONS
> > function ROTATE
> > {
> >        #######mount and rotate
> >        #days equal mon,tue,wen,thurs,fri,
> >         echo "Updating Recent MYOB Backups"
> >         rm -f /var/myob/fri/*.pls
> >         mv /var/myob/thr/*.pls /var/myob/fri
> >         mv /var/myob/wed/*.pls /var/myob/thr
> >         mv /var/myob/tue/*.pls /var/myob/wed
> >         mv /var/myob/mon/*.pls /var/myob/tue
> >         cp /home/students/jace/D/myob/cmc2000/*.pls
> > /var/myob/mon/"$(date).pls"
> >         echo "Recent MYOB Updated and Backed Up To JSERV"
> > }
> >
> > function GETZIP
> > {
> >        #######gets the zip
> >        if [ -f "/home/students/jace/d/nightlyzips/*.ZIP" ];then
> >                echo "Getting Last Nights Zip"
> >                mv /home/students/jace/D/myob/nightlyzips/*.ZIP
> > /var/myob/zips/"$(date).zip"
> >                echo "Zip Is Archived to JSERV"
> >        else
> >                echo "No New Zip To Archive"
> >        fi
> > }
> >
> > function CHUMPS
> > {
> >        ##########insert for loop here ie...for student in list mnt this
> >        #########mount chump in morn
> >        echo "Mounting Chumps Now!"
> >        for STUDENTS in "greg" "cam" "burner";do
> >                smbmount //$STUDENTS/C /home/students/$STUDENTS $RICHARD1
> >                echo "Chumps Mounted"
> >        done
> > }
> >
> > ########MAIN
> > echo "GOOD MORNING JASON"
> > echo "Doing Morning Startup Now"
> > echo "Starting Samba"
> > samba start
> > samba status
> > echo "Samba Started"
> > #$(CHUMPS)
> > #smbmount //jace/C /home/students/jace/C $RICHARD1
> > #smbmount //jace/D /home/students/jace/D $RICHARD1
> > $(ROTATE)
> > $(GETZIP)
> > echo "All MYOB Data On JSERV Now Current"
> > echo "Have A Good Day"
> >
> > exit 0
> >
> > output:
> > [root at jserv taproot]# ./phatstart.scrp
> > GOOD MORNING JASON
> > Doing Morning Startup Now
> > Starting Samba
> > Starting SMB services:                                     [  OK  ]
> > Starting NMB services:                                     [  OK  ]
> > smbd (pid 3392 2503) is running...
> > nmbd (pid 2508) is running...
> > Samba Started
> > ./phatstart.scrp: Updating: command not found
> > ./phatstart.scrp: No: command not found
> > All MYOB Data On JSERV Now Current
> > Have A Good Day
> >
> >
> >
> >
> > <br><br><br>  Jason Davis
> >   jd_480 at hotmail.com
> >
> > _________________________________________________________________
> > Get your FREE download of MSN Explorer at 
>http://explorer.msn.com/intl.asp
> >
> > _______________________________________________
> > Web Page:  http://lug.boulder.co.us
> > Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
>_______________________________________________
>Web Page:  http://lug.boulder.co.us
>Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp




More information about the LUG mailing list