Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to write a front-end for sending faxes in PHP. I want to know how can I get the status of a fax job.

When the user sent a fax, how can I report the status of the job to the user ? In case when the destination line was busy, unreachable, etc.

Is there any log file or a command that contains the status of a specific fax job which is transfer-able to the front-end ? So I can report back the success/failed message to user.

I know about faxstat -d, but it's a report for all jobs and i can't fetch that on php side.

enter image description here

As you can see the format of output is not something that can be parsed easily.

Just for reference, here is the list of all status codes.

I had a look at Hylafax's documentation but couldn't find anything on how to trace a job status.

share|improve this question
add comment

2 Answers 2

up vote 3 down vote accepted

I know about faxstat -d, but it's a report for all jobs and i can't fetch that on php side.

Sure you can. You have a couple options: system and exec.

Use one of those to run the faxstat command in combination with grep, and you should be able to get the data you want. Alternatively, suck in all of faxstat's output into a php variable, and then parse out the data you're looking for.

share|improve this answer
    
Please have a look at the edit. Is there a chance to get status from that kind of output ? Also, the output of faxstat -d will grow by time and the list will increase. Won't there be a problem with putting all these into a single php variable ? –  xperator Jun 19 '12 at 17:57
    
Looks easy enough to parse. Very simple using standard unix tools like grep, cut, etc. –  EEAA Jun 19 '12 at 18:19
add comment

The file in /var/spool/hylafax/doneq/q$job_id, where $job_id is your job #, is more descriptive. See here: http://hylafax.sourceforge.net/man/doneq.php

Files in the doneq directory specify completed transmission job requests. These files are created by hfaxd(8C), when submitting a job on behalf of sendfax(1) or sendpage(1). Job description files also reside in the sendq directory; they are moved from there to the doneq directory by faxq(8C) when a job completes.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.