As Chris and others have said, check your environment, however, there
are a lots of other subtle environmental difference, not covered under
$PATH, etc.

For example, what has gone on with file descriptors can also be an
issue.  From a terminal STDIN, STDOUT and STDERR are almost always open,
put possibly redirected, but depending on how daemons are started some
of these may be closed within a daemon environment.  Similarly, ulimit
settings are likely to be different, and, if you run with any form of
access control (SELinux, etc) then those settings may be different.

The easiest way to find most of these is to add debugging, i.e. redirect
all the output from the command in the script of interest (both STDOUT
and STDERR) and see what happens.  Turn on the logging output from mon,
etc, etc.  Unfortunately, if it isn't immediately obvious, it is
probably a subtle difference in your environment, and no one else will
find it without lots more information about that environment.

And BTW, your question about if anyone has run any shell scripts from
mon before, yep plenty of times.  I haven't looked at the latest
distribution but in earlier ones, test.alert was a shell script, as were
a few of the actual tests (e.g. ping.monitor).

Frank

On Fri, 2010-04-30 at 00:35 +1000, Chris Hoogendyk wrote:
> And, perl is "built in" too. I don't think there is a Linux or Unix that 
> comes without it. Been that way for years.
> 
> Also, I believe it's been pointed out that if it works from the command 
> line, but not from startup, that's an environment issue. Check your 
> environment and your dependencies in your bash shell. Use full path 
> lengths so that you aren't dependent on $PATH. And so on.
> 
> 
> ---------------
> 
> Chris Hoogendyk
> 
> -
>    O__  ---- Systems Administrator
>   c/ /'_ --- Biology & Geology Departments
>  (*) \(*) -- 140 Morrill Science Center
> ~~~~~~~~~~ - University of Massachusetts, Amherst 
> 
> <hoogen...@bio.umass.edu>
> 
> --------------- 
> 
> Erdös 4
> 
> 
> 
> 
> 
> Noel Butler wrote:
> > The point is mon is perl based, and there already exists a perfectly 
> > working sms.alert script, so why re-invent the wheel.
> > Since you are using a debian based system and they are well known for 
> > screwing things to their own liking I suggest you investigate your 
> > init.d mon script which it is pretty clear where the problem is.
> >
> >
> > On Wed, 2010-04-28 at 17:30 +0200, ad...@jack-clan.nl wrote:
> >> well, why use perl to do something, when it should work with bash, the
> >> built-in way to do things in linux?
> >> And mind it works, when i start mon -f it executes, but not when i run
> >> /etc/init.d/mon start.
> >>
> >>
> >> > Why don't you just use the perl sms.alert script?
> >> > whats the fascination with bash?
> >> > 
> >> > 
> >> > On Tue, 2010-04-27 at 16:28 +0200, ad...@jack-clan.nl 
> >> > <mailto:ad...@jack-clan.nl> wrote:
> >> > 
> >> >> No still ain't workin'
> >> >> Pffft ,has anybody used a shell script as an alert before ( in
> >> >> daemon-mode
> >> >> ) ?
> >> >> Otherwise i ll start mon as a program, not as a daemon, or are there
> >> >> reasons not to do so?
> >> >> 
> >> >> thanks
> >> >> 
> >> >> 
> >> >> sms.alert:
> >> >> 
> >> >> 
> >> >> #!/bin/bash
> >> >> 
> >> >> export
> >> >>
> >> PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
> >> >> 
> >> >> /bin/echo "servers down test" | /usr/bin/gammu --sendsms TEXT
> >> 0653638072
> >> >> 
> >> >> 
> >> >> 
> >> >> Jim Trocki :
> >> >> 
> >> >> 
> >> >> if it works when you do "-d -f" then from that shell do
> >> >> 
> >> >> echo $PATH
> >> >> 
> >> >> and put that path at the top of your bash script, e.g.
> >> >> 
> >> >> #!/usr/bin/bash
> >> >> 
> >> >> export PATH=/bin:/usr/bin:....whatever
> >> >> 
> >> >> 
> >> >> 
> >> >> _______________________________________________
> >> >> mon mailing list
> >> >> mon@linux.kernel.org <mailto:mon@linux.kernel.org>
> >> >> http://linux.kernel.org/mailman/listinfo/mon
> >>     
> 
> 
> _______________________________________________
> mon mailing list
> mon@linux.kernel.org
> http://linux.kernel.org/mailman/listinfo/mon
-- 
ac3
Suite 7002, Locomotive Workshop
2 Locomotive Street
Australian Technology Park
EVELEIGH NSW 2015

"Customised data centre solutions & managed IT services"

P: 02 9209 4600
M: 0401 714 870
F: 02 9209 4611
W: www.ac3.com.au

This email is for intended recipients only.  If you are not an
intended recipient, you must not disclose, copy or distribute this
email to others or act upon the information contained in this email
in any way.  This email may contain privileged or confidential
information.  If you have received this email in error, please
notify the sender and then delete it from your system.

_______________________________________________
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to