faxrunqd(1)

πŸ“¦
version 1.2.1 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble
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/inittab or 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 β€” Tells faxrunqd to write progress information to the log file. she's keeping receipts πŸ“
  • -D β€” Tells faxrunqd to run in the background, as a daemon. lowkey entering her daemon era πŸŒ€
  • -d β€” Tells faxrunqd to write debugging information to stdout and 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> β€” faxrunqd can now (since 1.1.29) run as unprivileged user. If you start it as root from /etc/inittab or 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 make faxrunqd drop all its privileges at startup, and run as the specified user. Running faxrunqd as 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 (see faxq(5)), the second is the last exit code from sendfax (for success-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 and faxrunqd gives 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 that faxrunqd will try to send any given fax. The default value is 10.
  • delete-sent-jobs [y/n] β€” Determines whether faxrunqd should 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 where faxrunqd should 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. faxrunqd will always explicitely tell sendfax which modem to use, so the settings in sendfax.config are ignored. If you use policy routing (see below), this applies only to fax jobs that do not have a tty set by faxrunqd.policy.
  • faxrunqd-log [filename] β€” Specifies where logging information is written to. This is only used if faxrunqd is called with the -v or -d option. πŸ“
  • 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), faxrunqd will 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-default sendfax binary 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 the high water'' threshold, and is back below this number. This can be used to send everything 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, faxrunqd just phases out a problematic modem, but will not report the problem). πŸ’€
  • delay-rule [errcode] [delay1] [delay2] [...] β€” fine-tune how long faxrunqd waits before re-sending a failed job after sendfax returned with error code "errcode". "delay1" is used after the first try, "delay2" after the second try, and so on. If faxrunqd needs 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 confuse faxrunqd'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, faxrunqd will 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 time faxrunqd runs the fax queue, a time stamp gets written into this file. faxspool uses 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:

  • SIGINT
  • SIGTERM β€” 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 telling faxrunqd "hey, I want you to terminate" without disturbing the normal flow of operation β€” because SIGINT/TERM etc. 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