I'm trying to do something that I believe to be very simple...I'm running a script that does a find on a specific directory on a linux server and report back how many files in that directry of a specific type are older than X minutes. This is what my scipt looks like:
#!/bin/sh
find /tmp/directory2/. -name "*.mp4" -type f -mmin +2 -printf '%p %a \n' | wc -l
When I run this directly from an SSH session it responds just fine with a count of how many files are in the directory...same goes for running this our of a command prompt on my IPMonitor server using Plink (root@10.5.0.53 -ssh -pw gr*****@ /tmp/findscript.sh)
So I have my external process monitor implemented, but it seems to be working in opposition to what I would expect. My monitor is set up with an "Expected Return Value" of 0. My expectation would be that if my script returns any OTHER value, it would fire off a warning, correct? Well...that doesn't seem to be the case.
Instead, when It's set to 0, No matter what the return value is, the monitor says that it's up. When I change the value to 1 or any other digit, then the monitor says it's down - no matter if the return value is 1 or 0 or whatever.
So what am I missing here? Is my script not set up right?
Any help would be greatly appreciated.
Thanks!