[Nut-upsuser] Unable run command on notify events

Arjen de Korte nut+users at de-korte.org
Fri Apr 8 14:04:36 UTC 2011


Citeren "GATINEAU, ANTOINE (ANTOINE)" <antoine.gatineau op alcatel-lucent.com>:

> I got it working. Aparently, the script is launched as the specified  
> user but without the environment variables.
> To make it work, i have defined NOTIFYCMD as following :
> NOTIFYCMD "/bin/bah -c 'source /etc/profile ; /path/to/script/scriptname"
>
> Is there a better way or is this the best way?

Scripts must be self-contained. It is grievous mistake to assume  
anything about the environment. So it is best to follow Arnaud's  
advice and use absolute paths to other scripts/binaries that you need.  
If that's not possible, it is probably better to source /etc/profile  
from within the script you're running.

Best regards, Arjen
-- 
Please keep list traffic on the list (off-list replies will be rejected)




More information about the Nut-upsuser mailing list