Re: [Apcupsd-users] apcupsd on Ubuntu 8.04 not sending emails
Brought to you by:
adk0212
From: Bill R. W. <br...@et...> - 2009-04-24 18:42:44
|
On Fri, Apr 24, 2009 at 08:59:01PM +0300, Bogdan wrote: > Bill R. Williams wrote: >> On Fri, Apr 24, 2009 at 12:56:04PM +0300, Bogdan wrote: >> >>> Hello people, >>> >>> I have an Ubuntu 8.04 server running a samba domain and I have the >>> computer attached to a APC UPS. I installed apcupsd via apt-get. The >>> software runs smooth, it detects the powerouts and acts accordingly >>> (it shuts down the computer when 3 mins of power remaining) but it >>> doesn't notify me via email. Thing is I use ssmtp, I configured it >>> good, modified the onbattery and offbattery scripts, they work when i >>> call them via "./onbattery" or "sh onbattery" but not on power loss. >>> they even work when i try "./apccontrol onbattery" or "./apccontrol >>> offbattery" . I receive the email. but they won't work when the power >>> goes out or in again. What can I do? >>> >> >> I have used ssmtp in the past -- handy-dandy utility! >> Great idea using it for this special purpose when nothing else needs >> system mail transport -- saves having to install/configure sendmail, >> postfix, exim, etc. >> >> ANYWAY... >> Since your script is running properly when invoked from the command >> line, but apparently does nothing when called by the daemon, I have to >> suspect it's a PATH problem. >> Try this: run your 'ssmtp' with its FQPN -- something like: >> /usr/bin/ssmtp bo...@my... < a >> or wherever it really is. (/usr/sbin?) >> >> Remember, things run under cron and/or other system utilities do NOT >> get the sampe PATH and other environmental settings as the interactive >> shell. A good safety tip is to ALWAYS define an explicit PATH= in >> scripts which will be run by daemons, cron jobs, or other root-type >> utilities. >> >> >>> permissions are ok, script files look like this: >>> >>> onbattery: >>> >>> #!/bin/sh >>> # >>> # This shell script if placed in /etc/apcupsd >>> # will be called by /etc/apcupsd/apccontrol when the UPS >>> # goes on batteries. >>> # We send an email message to root to notify him. >>> # >>> ssmtp bo...@my... < a >>> >>> exit 0 >>> >>> "a" file: >>> >>> Subject: Power Alert >>> >>> The Samba Server power supply is out!!! >>> >>> >>> >>> offbattery: >>> >>> #!/bin/sh >>> # >>> # This shell script if placed in /etc/apcupsd >>> # will be called by /etc/apcupsd/apccontrol when the UPS >>> # goes on batteries. >>> # We send an email message to root to notify him. >>> # >>> ssmtp bo...@my... < b >>> >>> exit 0 >>> >>> "b" file: >>> >>> Subject: Power Alert >>> >>> The Samba Server power supply is on again...you can chill out now :) >>> >>> >>> >>> >>> I don't know what to do, i tryed almost everything. Any ideea is >>> wellcome. Thanks guys and have a nice day. >>> >> >> > Still no luck :/ I changed to the full path of the executable, i even > tried with /usr/sbin/sendmail. Thanks anyway, and have a nice evening.... Mmmmm... interesting. Could it be... Where are files 'a' and 'b' located? Have you tried using FQPN to them? As in ssmtp bo...@my... < /etc/apcupsd/a ssmtp bo...@my... < /etc/apcupsd/b or wherever they are? -- --------------------------------------------- Bill R. Williams <br...@et...> ------------------------ ETSU Library Systems () ascii ribbon campaign - against html e-mail /\ www.asciiribbon.org - against proprietary attachments |