Home

Search this site:
 

Horshack’s
very
own site

 

This is Bavaria, Germany!
You will find links to Perl,
bootdisks for system administration,
a lot of Linux,
Windows administration
and some personal belongings.
Linux-daemons: Hylafax

Linux: daemons, Hylafax

Table of contents for Hylafax

 Which Faxjobs Are Waiting?

[root@glosmitsoos cgi-bin]# faxstat -s 
HylaFAX scheduler on glosmitsoos: Running 
Modem modem (+49+911+9600157): Waiting for modem to come free

JID|Number|TotTries|TotDials|Sender|MailAddr|Client|Status|TTS 
251|187|0|0|lippmann|lippmann@zirndorf.de|pc-lippmann.zdf||
 

Killing A Faxjob

Find Job-ID with faxstat -s (here it's ID=251, see the paragraph before this)

[root@glosmitsoos cgi-bin]# faxrm -a 251 
Password: ***************** 
Job 251 removed.
 

Which Faxjobs Have Been Submitted Today?

[root@glosmitsoos cgi-bin]# xferfaxstats -since '03/26/02 00:00'

Sender               Pages Time Pg/min Errs TypRate TypData 
Ertelt@zirndorf.de       2 1:39    1.2    0 14400 1-D MR 
lippmann@zirndorf.de     1 0:36    1.7    0 14400 1-D MR 
wunderlich@zirndorf.de   4 2:19    1.7    0  9600 1-D MR
-------------------------------------------------------------------- 
Total                    7 4:34    1.5
 

Howto change output of commands

You can change the output of a lot of commands. I made it for faxstat which makes it easier for me to analyze it in Perl. Change the file /usr/share/fax/hfaxd.conf

... 
# Original:
# JobFmt: "%-3j %3i %1a %6.6o %-12.12e %5P %5D %7z %.25s" 
# j=jobid 
# e=faxnumber_to_dial 
# t=total_tries_when_connected 
# d=total_dials 
# S=senders_name 
# M=email-adress_to_notify 
# c=clientmachinename 
# s=status, for example: no dialtone 
# z=time_for_next_trial 
JobFmt: "%j|%e|%t|%d|%S|%M|%c|%s|%z"
...

Who Is Allowed To Fax With Hylafax?

Who is allowed to fax to our faxserver is configured in /var/spool/hylafax/etc/hosts.hfaxd. These can be single IP-addresses or whole networks

[root@glosmitsoos etc]# cat hosts.hfaxd 

# localhost is allowed to fax 
127.0.0.1
# Mr. Brainstorm from our outer network is allowed to fax
10.95.82.12
# all machines from our net 10.95.81.* are allowed to fax
# pay attention to quote the dot 
10\.95\.81\.

Administrative Access to Hylafax

Administrative users are allowed to remove faxjobs (faxrm), view _all_ faxjobs (faxstat –s) etc. Administrative User is everyone who tries to access with hylafax-commandline-programms as an administrative user. You don't have to be root for that.

But who is an administrator user? This is noticed in the file hosts.hfaxd. You can insert users like that:

[root@glosmitsoos etc]# faxadduser -a geheim3 wende 
[root@glosmitsoos etc]# faxadduser -a geheim9 lippmann
[root@glosmitsoos etc]# cat hosts.hfaxd 

# localhost is allowed to fax 
127.0.0.1
# Mr. Brainstorm from our outer network is allowed to fax
10.95.82.12
# all machines from our net 10.95.81.* are allowed to fax
# pay attention to quote the dot 
10\.95\.81\.
#
# Everyone with a crypted password is an administrative user:
wende:::z6qz2/z3mhZS2 
lippmann:::3juc2g/bwGiHU

Eventually you have to restart hylafax to activate the users:

[root@glosmitsoos etc]# /etc/rc.d/hylafax stop
[root@glosmitsoos etc]# /etc/rc.d/hylafax start


Howto delete a faxjob from the commandline

If you have created the administrative users you can delete faxjobs. First find out which faxjobs are not done:

[lippmann@glosmitsoos lippmann]$ faxstat -s -l 

HylaFAX scheduler on glosmitsoos: Running 
Modem modem (+49+911+9600157): Running and idle
JID|Number   |MailAddr         |Status           |TTS 
252|026714337|pc-wunderlich.zdf|No local dialtone|12:50 
253|187      |pc-lippmann.zdf  |No local dialtone|12:50

[lippmann@glosmitsoos lippmann]$ faxrm -a 253 
Password: geheim9 
Job 253 removed.
 

Howto to Delete a Faxjob by Shellscript

You can delete faxjobs from an ftp-like interface to Hylafax:

lippmann> ftp 127.0.0.1 4559
Connected to 127.0.0.1.
220 faxserver.zdf server (HylaFAX (tm) Version 4.1beta2) ready.
Name (127.0.0.1:lippmann): lippmann <--- no password needed!
230 User lippmann logged in.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> quote "admin geheim9" <--- password is given here!
230 Administrative privileges established.
ftp> quote "jkill 435"
200 Job 435 killed.
ftp> quit
221 Goodbye.

If this works, you're on the way to successfully delete jobs by script which can be called from a web-interface. Write a perlscript to delete faxjobs like this:

#!/usr/bin/perl
&deletejob("geheim9",$ARGV[0]);
sub deletejob {
my ($adminpass,$killjob)=@_;
my $ftp = Net::FTP->new("127.0.0.1", Port => 4559)
|| print "Error: $!";
$ftp->login("lippmann","")
|| print "Error: $!";
$ftp->quot("admin",$adminpass)
|| print "Error: $!";
$ftp->quot("jkill", $killjob)
|| print "Error: $!";
$ftp->quit()
|| print "Error: $!";
}

I used this approach to kill printjobs from a webinterface. So I can delete jobs to wrong faxnumbers submitted by my users.



Last modified:
14.09.2003 11:23
Impressum
Wozu Witze ausdenken? Das Leben schreibt sie selbst:
Das haben wir jetzt 40 Jahre so gemacht, warum sollten wir das ändern?
Why inventing jokes? Real life does a better job:
We are doing it this way for 40 years, why should we change it?