Write to file from plugin


hi everybody,

i’m next to insanity so i hope somebody could help.
I’m writing a plugin, you can see it here below:


(sleep 5 ; sudo killall netcat )&

netcat 2112 > /home/nagios/filename.txt

it should collect data via netcat for 5 seconds and then should be killed.

if i run it from user nagios, manually via bash, it works. so it creates the file “filename.txt” with all the data inside

if i give it to nagios, to be run as plugin, the file is created but empty.

why this is happening??

help please


are you trying to run it as user nagios or as user root from command line?