HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

[hylafax-users] Notify Script: Cannot Modify



Greetings,

HylaFAX is an excellent and versatile program and I am grateful
to have it for my Linux at-home, desk-top system.

Because I send faxes from a stand-alone machine, I would like to
have a simple notification of jobs completed/failed directly to
my console without involving email.  A modification of the
/spool/bin/notify script would seem like an ideal way to
accomplish this.  Yet every time I attempt to modify the script,
none of the changes are implemented.

For example, after inserting the lines

echo $QFILE
echo $WHY

I receive no console output (even while using the sendmail -R
option).

The Server Trace log indicates that the NOTIFY script is being
executed.

However, other modifications to /spool/bin/notify result in a
Server Trace of "Bad Exit Status."

This behavior is very similar to that mentioned in another
posting to hylafax-users@hylafax.org by Johann Sijpkes on 24
January 2001:

> When printing faxes from the faxrcvd script all works fine
>
> but I want to do the same in the notify script, but now lpr
> cannot print the job (connection lost?)
>
> If I type the command at the prompt everything works fine, but
> when Hylafax invokes the script it can't print.
> My guess is that there's something wrong with my file
> permissions but I haven't been able to figure out which and
> why...

After examining the HylaFAX source code, I discovered that the
/spool/bin/notify script is executed by using a routine in the
/faxd/faxApp.c++ file at line 370:

/*
 * Run the specified shell command.  If changeIDs is
 * true, we set the real uid+gid to the effective; this
 * is so that programs like sendmail show an informative
 * from address.
 */
bool
faxApp::runCmd(const char* cmd, bool changeIDs)
{
    pid_t pid = fork();
    switch (pid) {
    case 0:
	if (changeIDs)
	    setRealIDs();
	detachIO();
	execl("/bin/sh", "sh", "-c", cmd, (char*) NULL);
	sleep(1);			// XXX give parent time
	_exit(127);
    case -1:
	logError("Can not fork for \"%s\"", cmd);
	return (false);
    default:
	{ int status = 0;
	  Sys::waitpid(pid, status);
	  if (status != 0) {
	    logError("Bad exit status %#o for \"%s\"", status, cmd);
	    return (false);
	  }
	}
	return (true);
    }
}

The /spool/bin/notify script is called from /faxd/faxQueueApp.c++
at line 2921 (notifySender routine) with changeIDs == true.

Unfortuneately, I am not that well versed in the art of Unix
system programming to be able to unravel just what is occuring
with the file permissions.  Thus I am posting this message to see
if someone else is able to fathom what is happening to the
/spool/bin/notify script when it is called using this routine.

How can I possibly modify the notify script so that instead of
email (to myself), I will receive a simple message on my console?

Larry Piet
Detroit, Michigan
USA



____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null




Project hosted by iFAX Solutions