Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redirect savepnpc output to group details?

Status
Not open for further replies.

nepomuk

Technical User
Dec 21, 2001
11
EU
If I run a batch script via savepnpc on an NT4 machine the ouput of the script gets lost!

how can I redirect the output of the script, so that I can see the result in the Nwadmin Group Details?

For Example if I use echo in the savepnpc it will show up!
precmd: "echo hello";
 
Remember: You can only see the output of the pre command, not the post command.
 
That would be enough!
lets say my precmd is "dir", how can I redirect the output of dir to the savegroup details?
 
The entire output is sent to the server. The savegroup details is truncated a bit, and the savegroup completion report is also truncated, but not as much. If you change the backup command to 'savepnpc -vvvv' you should get it all. In 6.0 and below that works, but I think 6.1 still truncates it.
 
But you must be aware, that networker treats all output as WARNING - so you will never have a SUCCEDED status, always a Warning.
So you must always check that backup if it really succeded or got wrinings due to other errors.

Johanes
 
Not true. Networker read the exit status (or return code), not the output.
 
I have done the job as following...
I have created two batch files. Middat1.cmd and Midday2.cmd.

Midday1.cmd has the following inside
@echo off
rd 123zz321 >nul
md 123zz321 >nul
for /f "tokens=1,2" %%a in ('dir ^| find /i "123zz321"') do echo MIDDAY Backup Started at %%a %%b
net send oonal "RDS3403 MIDDAY Backup Started..." > nul

Midday2.cmd has the following inside
@echo off
rd 123zz321 >nul
md 123zz321 >nul
for /f "tokens=1,2" %%a in ('dir ^| find /i "123zz321"') do echo MIDDAY Backup Finished at %%a %%b
echo #####
net send oonal "RDS3403 MIDDAY Backup Finised..." > nul


And the Midday.res file in c:\program files\nsr\res has the following lines in it.
type: savepnpc;
precmd: "Midday1.cmd >> Backup.log";
pstcmd: "Midday2.cmd >> Backup.log";
#End

All the files Midday1.cmd, Midday2.cmd and Backup.log reside in C:\winnt\system32 folder.

It works.

Here is the Backup.log file details.
MIDDAY Backup Started at 09/09/03 16:05
MIDDAY Backup Finished at 09/09/03 16:08
#####

Hope this helps to anyone who needs this info.
;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top