[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cobalt-developers] Shell Script Errors



Alright, I'm writing a simple shell script to execute a few commands based
on what time of day it is, after fixing the outdated and stripped down
version of the date command cobalt has on its Qube3's I managed to get the
command line to start printing out times via 'date +%H%M' (to print out
Hour:Minute) but now I'm having problems with my case statments and I'm not
sure why its happening. Below I'm stating the exact instances where I'm
having problems:

	[root /root]# sh qubebackup-0.4.sh
I run the shell script, it starts printing errors

	: command not found
	: command not found
	: command not found
	: command not found
	: command not found
	"t: unknown command "status

To this point there are no commands being issued, I'm setting variables
like:
BUFSIZE="32k"
DOW=`date +%w`
TIME='date +%H:%M'
HOUR='date +%H'
DATE=`date +%D`
DAY=`date +%A`
DEVICE="/dev/nst0"
DATA="/home"
REWIND="mt -f /dev/nst0 rewind"
EOD="mt -f /dev/nst0 eod"
FSF="mt -f /dev/nst0 fsf"

	usage: mt [-v] [--version] [-h] [ -f device ] command [ count ]
	commands: weof, wset, eof, fsf, fsfm, bsf, bsfm, fsr, bsr, fss, bss,
rewind,
          	offline, rewoffl, retension, eod, seod, seek, tell, status,
          	erase, setblk, lock, unlock, load, compression, setdensity,
          	drvbuffer, stwrthreshold, stoptions, stsetoptions,
stclearoptions,
          	defblksize, defdensity, defdrvbuffer, defcompression, sttimeout,
          	stlongtimeout, densities, setpartition, mkpartition, partseek,
          	asf.

I'm not quite sure WHY its printing this out considering its in responce to:
mt -f /dev/nst0 status
which should give me an echo of the status of the non rewinding device.

	: command not found

Here this is again... I'm going crazy, I swear.

	'ubebackup-0.4.sh: syntax error near unexpected token `in
	'ubebackup-0.4.sh: qubebackup-0.4.sh: line 63: `case "$TIME" in

This one I really don't get, its in reponce to my case statement:
case "date +%H:%M" in
	10:00) bru -L "${TIME}'s Hourly Backup" -cvvvVZXGBf \
		        $DEVICE $DATA > /tmp/backup.txt
		   mail $MAILLIST < /tmp/backup.txt
	;;
	12:00) bru -L "${TIME}'s Hourly Backup" -cvvvVZXGBf \
		        $DEVICE $DATA > /tmp/backup.txt
		   mail $MAILLIST < /tmp/backup.txt
	;;
	"14:00) bru -L "${TIME}'s Hourly Backup" -cvvvVZXGBf \
		        $DEVICE $DATA > /tmp/backup.txt
		   mail $MAILLIST < /tmp/backup.txt
	;;
	"16:00") bru -L "${TIME}'s Hourly Backup" -cvvvVZXGBf \
		        $DEVICE $DATA > /tmp/backup.txt
		   mail $MAILLIST < /tmp/backup.txt
	;;
	18:00) bru -L "${TIME}'s Hourly Backup" -cvvvVZXGBf \
		        $DEVICE $DATA > /tmp/backup.txt
		   mail $MAILLIST < /tmp/backup.txt
	;;
	*) exit *
esac

Am I going insane? Can someone help me out? I mean this should be working,
simple line by line from any good linux developers book would tell me that,
so I must be missing something.