Page 1 of 1

.bar command in Windows do not redirect to a file

Posted: Sun May 16, 2021 2:00 am
by FCC_Nagios_Support
Hello,
We have a script in Windows as:
net stop service
echo Stopped > log

Nagios nrpe shows an "ERROR incompatible to redirect entries"
Thanks

Re: .bar command in Windows do not redirect to a file

Posted: Mon May 17, 2021 2:24 pm
by vtrac
Hi,
How are you doing?

What "service" are you stopping in the batch script?
See if you have permission to write to "C:\Program Files\NSClient++\" folder.
Maybe you could try writing the "log" to different location (folder).


I tested this on my NSClient++ and looks like it is working for me.

I created a simple "check_workstation_stat.bat" and put that under the NSClient++ "scripts" folder:

Code: Select all

C:\Program Files\NSClient++\scripts\check_workstation_stat.bat
Here's the content of "check_workstation_stat.bat":
M3.png
I then "ran" the script on my XI command prompt:
M2.png
And here's the "Vinhlog" file under "C:\Program Files\NSClient++\" folder:
The "check_workstation_stat.bat" script was able to created the "Vinhlog" file ... (please see picture below).
M1.png

Best Regards,
Vinh

Re: .bar command in Windows do not redirect to a file

Posted: Wed May 19, 2021 9:24 am
by FCC_Nagios_Support
Many thanks Vihn.
Good with PowerShell

KR

Re: .bar command in Windows do not redirect to a file

Posted: Wed May 19, 2021 1:11 pm
by vtrac
Great!! .... May I close this thread?

Regards,
Vinh