#6737 - 2001-02-06 10:33 PM
>>Append output file not working
|
Anonymous
Anonymous
Unregistered
|
This command is suppose to output a file using >>. The file is there but no data. Is there something about KIX and >> or does this need to be in quotes.SHELL "%comspec% /C START /WAIT $DIRFOL\uptime $y /d:$LMONTH >> $FILFOL\report.txt"
|
Top
|
|
|
|
#6738 - 2001-02-07 10:26 AM
Re: >>Append output file not working
|
Anonymous
Anonymous
Unregistered
|
Had the same problem. Instead of SHELLing the command directly SHELL a batch file to do the same job.
|
Top
|
|
|
|
#6739 - 2001-02-07 02:21 PM
Re: >>Append output file not working
|
Anonymous
Anonymous
Unregistered
|
If I do that will my pre defined varibles pass thru to the batch command?
|
Top
|
|
|
|
#6740 - 2001-02-07 02:28 PM
Re: >>Append output file not working
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
No, passing variables to a batch works as follows :SHELL "Path\batch.cmd $var1 $var2 $var3" in the batch the variables you pass become : $var1 = %1 $var2 = %2 $var3 = %3 (up to ten) ... but i think the problem isn't the redirection (it always works for me) Can we have a look at the whole Script ? (could it be that $LMONTH has only 1 digit ?? see your other topic 'how to substract a month ') Luck Jochen [This message has been edited by jpols (edited 07 February 2001).]
_________________________
|
Top
|
|
|
|
#6741 - 2001-02-07 02:57 PM
Re: >>Append output file not working
|
Anonymous
Anonymous
Unregistered
|
If you also need to know the uptime.exe is on the 2000 resource kit. If there is a better way at doing this I would love to know.CLS BREAK ON $SNAME = "" $SLIST = "G:\SERVERS_701\SDATABASE\Slist.DAT" ;THIS GETS CHANGED IF OPEN(1,"$SLIST") = 0 $SNAME = READLINE(1) WHILE @ERROR = 0 $L=LEN("$SNAME") $X=SUBSTR("$SNAME",10,$L) $Y=SUBSTR("$SNAME",3,$L) $DAY=SUBSTR("@DATE",9,2) $MONTH=SUBSTR("@DATE",6,2) $LMONTH=val($month) - 1 $YEAR=SUBSTR("@DATE",1,4) $DIRFOL="c:\SERVERS_701\SDATABASE" ;DON'T CHANGE THIS $DATE="$LMONTH/01/$year" $FILFOL="c:\uptime\@MONTH" ;Testing purpose ; $FILFOL="U:\lans\uptime\@MONTH" ;Server directory IF EXIST ($FILFOL)=0 MD "$FILFOL" ENDIF ? "Working on $FILFOL on $Y server..." ;SHELL %comspec% /C START /WAIT $DIRFOL\"uptime $y /d:$date >> $FILFOL\report.txt" $NUL= ClearEventlog("$SNAME\APPLICATION") $NUL= ClearEventlog("$SNAME\SYSTEM") $SNAME = READLINE(1) LOOP $NUL = CLOSE(1) ELSE BEEP ? "ERROR,SERVER LIST NOT FOUND!" ENDIF ; I haven't got this to work either ;$RLIST = $DIRFOL\REPORT.TXT ;IF OPEN(2,"$RLIST") = 0 ; $SNAME = READLINE(2) ; WHILE @ERROR = 0 ;SHELL "cmd /C START /WAIT more $filfol\report.txt | find "Uptime Report for" >> $filfol\filter.csv ;SHELL "cmd /C START /WAIT more $filfol\report.txt | find "Total Downtime" >> $filfol\filter.csv ;SHELL "cmd /C START /WAIT more $filfol\report.txt | find "Total Reboots" >> $filfol\filter.csv EXIT
|
Top
|
|
|
|
#6742 - 2001-02-07 03:32 PM
Re: >>Append output file not working
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
USXKeaton :and if you try this ? : code:
CLS BREAK ON $SNAME = "" $SLIST = "G:\SERVERS_701\SDATABASE\Slist.DAT" ;THIS GETS CHANGED $DIRFOL="c:\SERVERS_701\SDATABASE" ;DON'T CHANGE THIS $FILFOL="c:\uptime\@MONTH" ;Testing purpose ; $FILFOL="U:\lans\uptime\@MONTH" ;Server directory $DAY=SUBSTR("@DATE",9,2) $MONTH=SUBSTR("@DATE",6,2) $YEAR=SUBSTR("@DATE",1,4) IF $MONTH = "01" $LMONTH = "12" $YEAR = val($YEAR) - 1 ELSE $LMONTH = val($MONTH) - 1 IF $LMONTH < 10 LMONTH = "0" + $LMONTH ENDIF ENDIF $DATE="$LMONTH/01/$YEAR" IF OPEN(1,"$SLIST") = 0 $SNAME = READLINE(1) WHILE @ERROR = 0 $L=LEN("$SNAME") $X=SUBSTR("$SNAME",10,$L) $Y=SUBSTR("$SNAME",3,$L) IF EXIST ($FILFOL)=0 MD "$FILFOL" ENDIF ? "Working on $FILFOL on $Y server..." SHELL "%comspec% /C START /WAIT $DIRFOL\uptime $y /d:$date >> $FILFOL\report.txt" $NUL= ClearEventlog("$SNAME\APPLICATION") $NUL= ClearEventlog("$SNAME\SYSTEM") $SNAME = READLINE(1) LOOP $NUL = CLOSE(1) ELSE BEEP ? "ERROR,SERVER LIST NOT FOUND!" ENDIF
The other shell command : code:
SHELL 'cmd /C START /WAIT more $filfol\report.txt | find "Uptime Report for" >> $filfol\filter.csv'
Jochen [This message has been edited by jpols (edited 07 February 2001).]
_________________________
|
Top
|
|
|
|
#6743 - 2001-02-07 04:20 PM
Re: >>Append output file not working
|
Anonymous
Anonymous
Unregistered
|
Here is the changes. I see the program running but I have no idea where the data is going. If you need the uptimei.exe utility you can go to http://www.microsoft.com/TechNet/winnt/Winntas/tools/uptime.asp There is no difference in the update.exe and updatei.exe CLS BREAK ON $SNAME = "" $SLIST = "G:\SERVERS_701\SDATABASE\Slist.DAT" ;THIS GETS CHANGED $DAY=SUBSTR("@DATE",9,2) $MONTH=SUBSTR("@DATE",6,2) $YEAR=SUBSTR("@DATE",1,4) IF $MONTH = "01" $LMONTH = "12" $YEAR = VAL($YEAR) -1 ELSE $LMONTH =VAL($MONTH) -1 IF $LMONTH < 10 $LMONTH = "0" + $LMONTH ENDIF ENDIF $DATE="$LMONTH/01/$YEAR" IF OPEN(1,"$SLIST") = 0 $SNAME = READLINE(1) WHILE @ERROR = 0 $L=LEN("$SNAME") $X=SUBSTR("$SNAME",10,$L) $Y=SUBSTR("$SNAME",3,$L) $DIRFOL="c:\SERVERS_701\SDATABASE" ;DON'T CHANGE THIS $FILFOL="c:\uptime\@MONTH" ;Testing purpose ; $FILFOL="U:\lans\uptime\@MONTH" ;Server directory IF EXIST ($FILFOL)=0 MD "$FILFOL" ENDIF ? "Working on $FILFOL on $Y server..." SHELL "%comspec% /C START /WAIT $DIRFOL\uptimei $Y /d:$date >> $FILFOL\report.txt" $NUL= ClearEventlog("$SNAME\APPLICATION") $NUL= ClearEventlog("$SNAME\SYSTEM") $SNAME = READLINE(1) LOOP $NUL = CLOSE(1) ELSE BEEP ? "ERROR,SERVER LIST NOT FOUND!" ENDIF
|
Top
|
|
|
|
#6745 - 2001-02-07 05:02 PM
Re: >>Append output file not working
|
Anonymous
Anonymous
Unregistered
|
SOBI found it. I went to verify the syntax again and found that there is a /s after the serverSHELL "%comspec% /C $DIRFOL\uptimei $Y /s /d:$date >> $FILFOL\report.txt" I can't believe I spent a whole day on this.
I want to thank you so much for all your support. Thanks again very much to everyone (this is the best group of people on the net.)
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 259 anonymous users online.
|
|
|