On Sat, Dec 30, 2006 at 03:48:24PM +0100, brian wrote:
Kevin Mark wrote:
On Sat, Dec 30, 2006 at 01:49:12PM +0100, Brian wrote:
Hi,
I have a Debian Sarge box and an NSLU2 (Unslung) that I have setup to 
send me mails when they startup, reboot, and do various other things, 
they use Nail to sned the emails to me. I tried to setup my mothers PC 
to do the same, no way I can get it to work. If I run the scripts by 
hand all works OK.
So I have a script /usr/sbin/mailtext.sh, that calls Nail with 2 
parameters.  In RC.0, RC.3 and RC.5 is have symbolic links to a script 
in /etc/init.d that calls mailtext.sh.
Mailtext gets called, and I have inserted logger statements in the 
script, those messages appear in my /var/log/messages, so I know that my 
script is called when it should be.
But, I never get the mails. If I run the script by hand as root then I 
get the mail. So I thought maybe something else needs to be started 
beforehand, but this runs as last in rc.3 amd rc.5, so network is up by 
then.
Just wondering how to debug this further, how can I get any error 
messages from nail into my logs? All I tried up till now doesn't seem to 
work.
Cheers Brian
try adding some logging to the script at the beginning and the end to a
a file.
echo "starting my script" >> mylogfile.log
cheers,
Kev
Kev,
just FYI here is the script:
mailtext.sh
#!/bin/sh
set -x
/bin/logger "/opt/sbin/mailtext Sending "$1" to Brian"
echo "$2" | nail -v -s Slug1:"$1"  brian_dorling@t-online.de
That gives plenty of output, just can't figure out a way to capture it yet.
Cheers Brian
echo "$2" | nail -v -s Slug1:"$1"  brian_dorling@t-online.de >> mylogfile 2>&1
-Kev