Write to file from plugin


#1

hi everybody,

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


#!/bin/bash

(sleep 5 ; sudo killall netcat )&

netcat 192.168.199.150 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


#2

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