[Nut-upsuser] NOTIFYCMD not running
Roger Price
roger at rogerprice.org
Tue Feb 11 16:18:13 GMT 2020
On Tue, 11 Feb 2020, Max Pierson-Liénard wrote:
> > When you run that command, does "some text" appear in the system log?
> When I run Documents/scripts/ups-log.py manually I do see the expected text echo'ed to the command line. It actually appends to a Google
> Sheet, not the internal log files.
>
> When I would expect to see it triggered by NOTIFYCMD, I don't see any text printed and nothing shows up at the google sheets. If the
> permission was being denied, would that be logged somewhere?
Suggestion: in the ups-log.py script, open a local debug logging file with
handle "fd_log" in mode "append". Record every call of ups-log.py in "fd_log",
whether valid or not. Does "some text" appear in "fd_log"? For the other calls
of ups-log.py, does anything appear in "fd_log"?
Roger
For example:
# Function open_log_file opens a file for logging
# The file owner will be uid, with group gid, e.g. upsd:daemon
# Returns file handle
def open_log_file (logfile, uid, gid) :
try :
fd_log = open(logfile, 'a') # Opened for current user, re-open if user change
os.chmod(logfile, 0o664)
os.chown(logfile, uid, gid)
return fd_log
except :
Your favourite error handling ...
More information about the Nut-upsuser
mailing list