faxrunqd(1)
okay bestie, welcome to faxrunqd(1) π the icon of the mgetty+sendfax manual. this is part 1 of 2, so don't you dare leave, we're just getting started πβ¨
πΈ NAME πΈ
faxrunqd β the daemon that sends all the fax jobs your queue set up with faxspool(1) π«Ά
β¨ SYNOPSIS β¨
faxrunqd [-v] [-d] [-D] [-l <ttys>] [-u <user or uid>] [ -g <group or
gid> ] [-V]
π DESCRIPTION π
so basically she runs in the background, and like, regularly checks the fax queue that faxspool(1) set up. She sends all the jobs that are due, records the results, and then does the appropriate little follow-up (notify mails, etc.). main character behaviour, honestly π
ngl faxrunqd is basically doing the exact same thing as faxrunq(1), just... more so β¨. So if you're not already familiar with the whole concept, pls go read the faxrunq(1) man page first, bestie, i'm serious π.
The advantages of faxrunqd are, and i quote:
- she runs all the time, so you don't have to set up a cron job (but you do have to set up an entry in
/etc/inittabor start it from/etc/rc*) β° - quicker response to new faxes in the queue πββοΈπ¨
- can sensibly handle more than one modem πͺ
- can handle prioritized fax jobs π
- can do 'policy routing' of faxes depending on the fax number πΊοΈ
and the disadvantages, because we keep it real here:
- needs more system ressources if you have only little fax traffic π¬
- requires Perl 5.004 πͺ
- more tricky to set up and to debug π
π οΈ SETUP π οΈ
faxrunqd gets started at system boot from /etc/rc.*, or from /etc/inittab. You can also just start it from the command line, no gatekeeping π
. She does not put herself in the background, so you have to start her with an &, or from a :respawn: line in /etc/inittab. And using /etc/inittab has the advantage that faxrunqd gets restarted automatically if something goes wrong and faxrunqd is stopped. self-healing queen β¨
so first, faxrunqd will read a global configuration file (see below), then (optionally) the faxrunqd policy file (see further below). From then on, she will sit in a loop, like, forever. She checks the fax queue every 60 seconds for new jobs, and will then distribute them over all available modems. If the job is sent, or fails, she'll do the same thing faxrunq(1) would do (send a mail, delete the JOB directory, execute a named program, etc.). Both programs are fully compatible in this respect π€.
faxrunqd [-v] [-d] [-D] [-l <ttys>] [-u <user or uid>] [ -g <group or
gid> ] [-V]
π OPTIONS π
-vβ Tellsfaxrunqdto write progress information to the log file. she's keeping receipts π-Dβ Tellsfaxrunqdto run in the background, as a daemon. lowkey entering her daemon era π-dβ Tellsfaxrunqdto write debugging information tostdoutand the log file (usually used together with-v). it's giving detective mode π-l<ttyS>β Specifies the list of modem devices to use. Multiple devices are separated with':', e.g.'-l ttyS0:ttyS1'. colon-separated, periodt βοΈ-u<user or uid>βfaxrunqdcan now (since 1.1.29) run as unprivileged user. If you start it as root from/etc/inittabor from one of the/etc/rc*scripts, it's strongly recommended to use'-u uucp'(to be precise: the user that is owning the outgoing fax spool directory). This will makefaxrunqddrop all its privileges at startup, and run as the specified user. Runningfaxrunqdas root user might lead to security problems β don't do it. This parameter takes either a uid or a username as argument. protect her π«Ά-g<group or gid>β Same effect as above but for the group id. Indicates the group which should own the fax files. This parameter takes either a gid or a groupname as argument.-Vβ print version number and exit. short, sweet, iconic π
π CONFIGURATION FILE π
Some aspects of the behaviour of faxrunqd can be controlled by a configuration file, usually named /etc/mgetty/faxrunq.config (this is the same file that faxrunq(1) uses, but there are additional options for faxrunqd). In this file, you can use the following options:
success-send-mail [y/n]β A boolean parameter that controls whether a mail will be sent after successful completition of the fax job. πfailure-send-mail [y/n]β A boolean parameter that controls whether a mail will be sent after the fax job has failed more than the maximum number of times. πsuccess-call-program <name>β Here, you can specify a program that will be run when the fax has been successfully sent. It will be passed two command line parameters. The first is the full path to the fax JOB file (seefaxq(5)), the second is the last exit code fromsendfax(forsuccess-call-program, this is always"0"). πfailure-call-program <name>β Similar to the"success-call-program", this program will be run when the fax has been failed too often andfaxrunqdgives up. This script could, for example, print out the fax on a printer so that it can be sent manually on a paper fax machine. πupdate-call-program <name>β This is, again, similar to"success-call-program". It will be called for interim status updates ("we've tried and it was BUSY"), so that frontend programs can display this information."update-call-program"will only be called for jobs that will be kept in the fax queue for at least one more try. π’maxfail-costly <n>β This specifies the number of times that a fax may fail"fatally", that is, causing telephone costs (explained above). The default value is 5.maxfail-total <m>β This is the absolute maximum number of times thatfaxrunqdwill try to send any given fax. The default value is 10.delete-sent-jobs [y/n]β Determines whetherfaxrunqdshould delete jobs after sending, or leave them in the fax queue (while moving the"JOB"file to"JOB.done") so that they can be seen at by"faxq -o". The default value is"do not delete sent faxes". ποΈacct-log <path>β Specifies wherefaxrunqdshould protocol success and failure of each try to send a fax job. The default location is/var/spool/fax/outgoing/acct.log. π§Ύ
π the options that are specific to faxrunqd are π
fax-devices [tty(s)]β Specifies which ttys should be used for sending jobs.faxrunqdwill always explicitely tellsendfaxwhich modem to use, so the settings insendfax.configare ignored. If you use policy routing (see below), this applies only to fax jobs that do not have a tty set byfaxrunqd.policy.faxrunqd-log [filename]β Specifies where logging information is written to. This is only used iffaxrunqdis called with the-vor-doption. πpolicy-config [filename]β Specifies a file containing rules for"policy routing", see below. Default is"no file". πΊοΈfaxrunqd-max-pages [n]β If this is set to something greater 1 (default is 10),faxrunqdwill combine multiple jobs to the same receipient telephone number into one telephone call. The maximum number of pages that the resulting job may have is specified here. Usually it makes no sense to increase this, but in some surroundings it might make sense to turn off this feature by setting it to 1. πππsendfax-tty-map [tty] [program path] [args]β Some special cases might require running a non-defaultsendfaxbinary for specific ttys (like"testing new version"or"some other call-compatible sendfax applications for non-class-2 modems"). If you want mappings for more than one"special"tty devices, just use the option multiple times. Example:
sendfax-tty-map capi0 /usr/sbin/sendfax.capi
queue-length-high [number] [program path] [args]β run the specified command when the number of jobs in the fax queue exceeds number (this could be used to send out a warning by syslog or e-mail when too many modems fail on a busy system, and faxes get stuck). The script will be run only once, unless the queue length falls below the ``low water mark'' threshold and rises again later on. π¨queue-length-low [number] [program path] [args]β run the specified command when the queue length has been over thehigh water'' threshold, and is back below this number. This can be used to sendeverything is back to normal'' e-mails, or just to reset the alarm threshold. βmodem-error-threshold [number] [program path] [args]β this script is called whenever a given modem has more than number consecutive errors. Every successfully sent fax always resets the counter for a given modem to 0. This can be used to notify the sysadmin when a modem breaks (by default,faxrunqdjust phases out a problematic modem, but will not report the problem). πdelay-rule [errcode] [delay1] [delay2] [...]β fine-tune how longfaxrunqdwaits before re-sending a failed job aftersendfaxreturned with error code"errcode"."delay1"is used after the first try,"delay2"after the second try, and so on. Iffaxrunqdneeds more tries than delay values are specified, the last one will be re-used. The values given are interpreted as seconds, unless postfixed with'm'(e.g."60m"), in which case they are interpreted as minutes. β³
π POLICY ROUTING π
okay bestie, this is the fun part β faxrunqd can literally switch up its whole vibe depending on which phone number the fax is going to. no cap. and that's actually so useful, like:
- send in-house faxes over a specific modem that's connected to a PABX (so you don't pay telco charges, we love a budget queen πΈ)
- send long-distance faxes to the US over a special LD provider β i.e. use a specific dial-prefix just for those
- use extra high debugging when you're sending to a recipient you already know is problematic π
- etc.
This whole thing is controlled by a file that holds your match / substitute rules. You tell faxrunqd where that file lives with the "policy-config" option in faxrunq.config. periodt.
The file gets read top to bottom, no skipping around. Any line that starts with a # is a comment and gets skipped. In every other line, the first field is read as a "match" clause and gets compared against the phone number of a to-be-sent fax job. Regular expressions are allowed here (see perlre(1)) β yes, you get the regex, you're welcome β¨
If the phone number matches, the second field is used to substitute parts of the phone number. Like, cut off a local prefix, swap a digit, whatever your heart desires. And if you don't want any substitutions at all? Just put a - in that field, easy.
The third field says which tty lines to use for the faxes matched by this line. (Think: one modem hooked up to a long-distance provider, others for local use, that kind of setup.) Pop a - in this field if you just want the default fax modems.
Everything left over on the line gets appended to the sendfax command line. That's where you can set a different dial-string ("-D ATD"), or crank the debug level way up ("-x 9"), or literally anything else you can dream up. π
π¨ DO NOT set a tty to use here ("-l ttyS1")!! it would confusefaxrunqd's internal tty handling and lead to weird effects while processing the fax queue. like, genuinely weird. don't do it.
Examples, because seeing it is believing:
# 12345-nnn is sent to "nnn" over a local PABX, modem on tty2
^12345 s/12345// tty2
# fax to 56789 (exact match) is sent with higher debugging
^56789$ - - -x 8
ποΈ FILES ποΈ
/var/spool/fax/outgoing/stopβ if this file exists,faxrunqdwill stop whatever it's doing at that exact moment, wait for all the outstanding jobs to finish, and then just π΄ fall asleep until the file is removed. Super handy for stopping queue processing while you're testing something, or for when you already know the modem(s) are unavailable and you'd rather not run into a bunch of error messages, etc./var/spool/fax/outgoing/faxqueue_doneβ every single timefaxrunqdruns the fax queue, a time stamp gets written into this file.faxspooluses it to show you a warning if the queue hasn't been run recently (which means your faxes might be stuck π).
π¦ SIGNALS π¦
to control faxrunqd's behaviour, you can send it these signals:
SIGINTSIGTERMβ remove the lock file, remove the pid file, terminate immediately. bye πSIGHUPβ finish all the fax jobs that are currently being sent, then terminate. This is the one you use when you're tellingfaxrunqd"hey, I want you to terminate" without disturbing the normal flow of operation β becauseSIGINT/TERMetc. can lead to some faxes being sent twice. πSIGUSR1β close, roll, and re-open the log file.SIGUSR2β dump the current modem success/failure statistics to the log file.
π BUGS π
faxrunqd does not report if a modem goes bad β instead it will just quietly stop using it. Which is honestly great for reliable faxing, but lowkey bad for error recovery. iykyk.
π SEE ALSO π
faxspool(1), sendfax(8), faxq(1), faxrunq(1), faxqueue(5)
π AUTHOR π
faxrunqd is Copyright (C) 1997-2004 by Gert Doering, <gert@greenie.muc.de>. It was inspired by Bodo Bauer's initial faxrunqd, but completely rewritten.
and that's the whole page, bestie!! πβ¨ this gorgeous thing comes from greenie, dated 23 Nov 02, and it's the faxrunqd(1) manual page β go forth and fax responsibly ππ¦π
π¦ where this page comes from
- debian bookworm: mgetty-fax 1.2.1-1.2
- debian trixie: mgetty-fax 1.2.1-2
- ubuntu jammy: mgetty-fax 1.2.1-1.1
- ubuntu noble: mgetty-fax 1.2.1-1.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms