SHUSH(1)
πΈ SHUSH(1) β General Commands Manual πΈ
okay bestie, sit down, hydrate, because we're about to talk about shush β and she's lowkey a main character in the cron world π
β¨ NAME β¨
shush β run a command and optionally report its output by mail π
β¨ SYNOPSIS β¨
shush [ -h | -V ]
shush [ -c dir ] [ -S | -s facility ] [ -vfmk ] name [ ID ]
shush [ -c dir ] [ -H to ] [ -R to ] [ -T to ] -C name [ stdout [ stderr ] ]
shush [ -i | -u | -r ] [ -c dir ]
β¨ DESCRIPTION β¨
so, shush runs a command and then optionally reports its output by mail. it's literally the perfect little wrapper around your cron jobs, no cap. π«Ά
by default? shush produces zero output while running, because everything (or, like, anything) gets reported by mail instead. it's giving silent but deadly efficient β¨. however β and this is the important part β configuration errors and critical errors will get reported on the standard error and (optionally) to syslog. so it's not actually silent, she just doesn't do small talk.
β οΈ okay so interruptingshushhas dire consequences, including the likely loss of any output from the command. like, it's that serious. so the following commonly used signals are ignored byshush:SIGHUP,SIGINT,SIGQUITandSIGTERM. π
and if you really insist on killing a running instance of shush β rather than killing the running managed command, which is what you probably actually want β you can use SIGKILL. and honestly? it shall serve as a reminder of how inappropriate such action typically is. π periodt.
for a command to be run using shush, a configuration file name must exist in the configuration directory ($HOME/.shush by default, cutie π). this file defines how the command should be run and when to send reports by mail. for the deets on all the available configuration parameters, go peek at the CONFIGURATION section below β it's right there, don't skip it π
two additional configuration files may also exist: name.stdout and name.stderr (by default). these are used to look at the standard output and standard error (respectively) produced by the command. for details on how to use these, see the COMMAND OUTPUT section below. π¬
when the -C option is specified, shush will only load the configuration, optionally analyze the standard output and standard error from the specified files, and finally produce sample reports if desired. it's the "just checking" era, and we love her for it π
this may also be used to produce reports if shush failed to properly terminate when running a command. (the standard output and error from the command are normally found in files located under /tmp.) π
ποΈ the crontab management bit (still DESCRIPTION, bestie)
shush is able to manage crontab(5) entries based on configurations defined by the user. and she can do it in one of two ways, iconic:
- if a file named
scheduleexists in the configuration directory, then it is read for scheduling information. each line should contain a single entry containing three fields separated by whitespace(s). the fields are, in order:- the hostname for which the entry applies, or the character
*to include all hosts π - the configuration name
- and finally, the scheduling information, in the same format as is used by the
scheduleparameter (see below)
- the hostname for which the entry applies, or the character
to specify an ID, use name:ID as the second field. iykyk β¨
- if there is no file named
schedule, thenshushchecks the configuration directory for configuration files and adds them to the current user'scrontab(5)file as specified by the includedscheduleparameter (see below).
π¨ heads up: files whose names start with the character#or end with the character~are ignored. bye girl π
β¨ OPTIONS β¨
she's got range, and every single one of these matters, so buckle up π
-hβ display a brief help message. the "hey bestie what do i do" button π«Ά-Vβ display the version information. prefix with-vto display compile time defaults. π-c dirβ specify the directory where configurations are stored. π-s facilityβ defines the syslog facility to use for logging. π-Sβ disable syslog logging. not today, syslog π-vβ copy information log messages to the standard output. she's chatty now, and honestly? obsessed β¨-fβ fast mode: any configuredrandomdelayis ignored. zoom zoom π¦-mβ monitor and display the command's standard output and error in real time. live feed, no delay, main character energy π-kβ keep the command's output log files instead of deleting them upon completion. she's sentimental, let her keep the receipts π-Cβ check the configuration without running any command. just vibes, no execution π-H toβ send a sample HTML report to the specified recipient(s). cute AND formatted π-R toβ send a sample enriched report to the specified recipient(s). enriched, as a treat πΈ-T toβ send a sample text report to the specified recipient(s). plain text, still slay β¨-iβ usecrontab(1)to install a newcrontab(5)file for the current user.
β οΈ the user must not already have a crontab(5) file. fresh start only, no exceptions π
-uβ usecrontab(1)to update the current user'scrontab(5)file, which must already exist. glow-up era π-rβ remove any entry added by the-uoption from the current user'scrontab(5). we're decluttering, bestie π§Ή
okay that's part 1 and there's more coming, so don't go anywhere π
π CONFIGURATION π
okay bestie, so a shush config file is made of a main section, report section(s), and parameters. The main section is the boss β it sets the global parameters AND the defaults that reports inherit. Every report section kicks off with the report's name wrapped in brackets. Any line starting with #? Ignored, don't even worry about it π
.
And listen: each parameter should only be written once. Write it more than once and everything except the last one gets ignored β unless the page says otherwise, so watch out π.
Parameters get written like this:
name=value
or:
name@hostname=value
or:
name%ID=value
or finally:
name@hostname%ID=value
Here's the tea β: the second and fourth formats? They get ignored unless shush is actually running on that hostname. The third and fourth formats let you define multiple instances of one single config file β those config files need an instance ID to run at all. And any config line using the third or fourth format gets ignored if the ID on that line doesn't match the instance ID you ran shush with. fr fr, that's the whole vibe.
π Parameters that live in the main section π
commandβ the actual command to run. Before it runs,shushsets two environment variables for it:SHUSH_NAMEgets set to name, andSHUSH_IDgets set to ID. slay.configβ defaults to the full path of the main configuration file. The other two config file names? You get them by appending the.stdoutand.stderrsuffixes onto whatever this parameter is set to. easy.lockβ if you set this, it tellsshushto grab a lock file before running the command, and it defines what to do when some other process is holding that lockfile. Format is a comma separated list of actions. The valid actions are: a time duration (during whichshushjust waits and keeps trying to get the lockfile), the string"abort"(meaningshushterminates immediately if the lockfile already exists), the string"ignore"(meaningshushpretends an existing lockfile isn't there), the string"loop"(which marks where to start again from once all the actions have run), and the string"notify="followed by mail addresses where a notification mail should go. Actions run in the order you give them, and once they're all done,shushwill wait forever trying to grab that lockfile β unless"loop"is one of the defined actions. Time durations use units ofw(eeks),d(ays),h(ours),m(inutes) ors(econds). No unit? It assumes minutes, periodt.lockfileβ by default,shushuses a file sitting in the same directory as the config file, named after the configuration and host names. Want a different name? This parameter's your girl.lockmsgβ if you set this, the string becomes the subject line for the lock notification mail message(s). The default is"[%u@%h] **PENDING** %N [%t]". Peep the MAIL SUBJECT section for the format deets πpathβshushdoes not touch the environment, except to set thePATHvariable if this parameter is set. that's it, that's the whole thing.randomdelayβ set this andshushwaits up to the specified amount of time before starting the command, unless it was invoked with the-f. Valid time units:s(econds),m(inutes),h(ours),d(ays),w(eeks). No unit specified? It assumes minutes.scheduleβ this defines when to run the command as a cron job, in acrontab(5)compatible format. You can specify multiple entries using the";"character as a separator, and entries prefixed with the"#"character get skipped. Heads up:shushdoesn't actually use this parameter to run the command itself β it's used by the-iand-uoptions. iykyk.sendmailβ use this to override the command used to send mail.shellβ by default, the Bourne shellsh(1)runs the command, which means you get to use any shell syntax you want. Define an alternate shell with this parameter if that's your vibe.statedirβ this defines the directory whereshushsaves its status, and it defaults to the.statedirectory under wherever the config lives. If that directory doesn't exist you get an error β unless this option wasn't set. Setting this option to an empty string stopsshushfrom saving its status at all. Andshlast(1)uses these state files to report on running instances ofshushplus previous runs π«Άsyslogβ this one is only used by the-iand-uoptions, no other effect onshushwhatsoever. It lets you override the default syslog facility used for logging (the one defined at compile time). Leave it blank and you suppress the use of syslog entirely.timeoutβ this parameter lets you control how long the command is allowed to run. Should be a comma separated list of actions. Valid actions are: a time duration (during whichshushjust waits for the command to terminate), a signal (either"SIGNAME"or"-SIGNUMBER") that gets sent to the command's process group, a signal (either"=SIGNAME"or"=SIGNUMBER") that gets sent to the shell used to spawn the command, the string"loop"(marks where to start again from once all the actions have run), and the string"notify="followed by mail addresses where a notification mail should be sent. Actions execute in the order you give them, and if the command is still running once they're all done,shushwaits forever β unless"loop"is one of the defined actions. Time durations use units ofw(eeks),d(ays),h(ours),m(inutes) ors(econds). No unit? Minutes, assumed, always πtimeoutmsgβ set this and the string becomes the subject for the timeout notification mail message(s). Default is"[%u@%h] **TIMEOUT** %N [%t]". Again, MAIL SUBJECT section has the format tea.
πΈ Parameters that can live ANYWHERE in the config πΈ
If you put these in the main section, they become the default settings that apply to any report that hasn't defined that same parameter itself. cute.
to,cc,bccβ where to send the mail report. yes, all three, one bullet, that's just how they're listed bestie.subjectβ subject of the mail report. MAIL SUBJECT section for the format details.headerβ additional mail header(s). Quick note: you can repeat this parameter to specify multiple headers. But β and this is important β for any given report, only the headers from the report (if specified) or from the main section will be used. pick a lane β¨hostprefixβ by default, subjects get prefixed with the host name between brackets. This parameter lets you customize that prefix. A positive integer says how many components of the fully qualified hostname to show. A negative integer says how many trailing components of the fully qualified hostname to trim off. The integer zero means omit the prefix entirely. Oh, and this parameter gets ignored if the"subject"contains any%character. noted.userprefixβ by default, subjects get prefixed with the username between brackets. This parameter lets you disable that. Any non zero value means show the username, while zero means omit the prefix. Same deal as above: ignored if the"subject"contains any%character.output(previously"stderr") β this defines how the command's standard output and standard error get captured and reported back to you:"errfirst","mixed","outfirst". When you use"mixed", thename.stderrconfiguration file is ignored. When you use"errfirst"or"outfirst", individual reports can use one of two extra options:"outonly"and"erronly".formatβ mail messages sending the command's output can go out in three different formats:"text"(the default),"enriched"text, or"html".sizelimitβ by default the entire output of the command gets sent in mail reports. This parameter limits the size of the output included in a report. Watch out: the total size of mail sent will be greater than this, because the limit has zero effect on mail headers. Size units arem,k,b,c(MB, KB, Bytes). No unit specified? Assumed to be KB. A limit of zero means don't truncate the output at all.ifβ a report only gets sent if no if condition is specified, or if the specified if condition is true. The condition syntax allows the usual logical operators ("||","&&","!"), comparison operators ("==","!=","<","<=",">",">=") and basic arithmetic operators ("+","-"). Aside from counters defined by the configuration (scroll to the COMMAND OUTPUT section below π), you can use these variables:$exitβ if the command terminated normally, this is its exit code. Otherwise it's negative and indicates the signal number that caused the command to terminate (e.g.-1means signal number 1 caused the command to terminate).$sizeβ output size (in bytes), same as"$outsize + $errsize".$outsizeβ size (in bytes) of standard output.$errsizeβ size (in bytes) of standard error.$linesβ number of lines output.$outlinesβ number of standard output lines.$errlinesβ number of standard error lines.$runtimeβ command run time (in seconds).$utimeβ user time used by the command.$stimeβ system time used by the command.$ttyβ1ifshushis run from a terminal (like, interactively),0otherwise.
that's part 2 babes, keep scrolling, we are NOT done π
π MAIL SUBJECTS π
okay so the lockmsg, timeoutmsg and subject parameters can have these lil tokens in them, and they get expanded like this, bestie:
%%β it's literally just the%character, iconic%hβ the hostname, slay%<digit>or%-<digit>β a partial hostname π«Ά a positive digit tells you how many components of the fully qualified hostname to keep, and a negative digit tells you how many trailing components of the fully qualified hostname to trim%iβ the instance ID%nβ the configuration name%Nβ the configuration name and the instance ID, together, as a duo β¨%rβ the report name%tβ the elapsed time%uβ the username%Uβ the userid
β οΈ and listen β if the%character shows up in thesubjectparameter, then thehostprefixanduserprefixparameters get ignored. like, fully ghosted. no cap.
π COMMAND OUTPUT π
so after your command finishes doing its thing, shush is gonna peek at the contents of the name.stdout and name.stderr files β but only if they exist, obvi β to look at the output your command produced.
these files are giving simple format energy. every line is one single character (the counter name) followed by a regular expression. that's it, that's the whole vibe π
all counters start out initialized to 0 (zero, bestie). then every line of output gets matched against these regular expressions until a match is found. the moment one matches, the associated counter gets bumped up by one. πΈ
and then?? those counters can be used as part of the main configuration, inside an if configuration parameter β so the decision to send a mail report can be based on how many times certain regular expressions got matched. it's giving data-driven decisions, we love to see it.
finally, regular expressions can define sub-expressions, and those get rendered in bold in mail reports. main character formatting energy fr fr.
lines starting with the character # are considered comments and get ignored, periodt. and by default, standard regular expressions are used β unless the first line is #pcre, in which case Perl compatible regular expressions are used instead. plot twist π¦
π ENVIRONMENT VARIABLES π
HOMEβ if the-coption isn't used, shush will look for configuration files in$HOME/.shush. so cozy.SHUSH_SENDMAILβ if defined, this should point to thesendmail(1)binary. this variable overrides thesendmailconfiguration setting and should be used with care, bestie. handle with caution, it's giving sharp edges. β οΈTMPDIRβ the directory where temporary files are created. π
π§ EXAMPLE π§
the following configuration runs shush -c /etc/shush -u daily at 9:00, updating the user (root) crontab:
command=shush -c /etc/shush -u
schedule=0 9 * * *
lock=notify=root root-logs,abort
timeout=5m,loop,notify=root root-logs,15m
stderr=first
format=text
Subject=Crontab Daily Update
[logs]
to=root-logs
[readers]
if=$exit != 0 || $outlines != 1 || $errsize > 0 || U
to=root
format=rich
the associated configuration for standard output is:
Oshush: crontab updated\.$
U^.+$
and for standard error:
U^(.+)$
okay so here's what's actually going down π a lock will be set while running the command, and mail gets sent to root and root-logs if the lock is held by another process when shush starts β in which case shush will abort. a mail will also be sent to root and root-logs if shush -c /etc/shush -u runs for more than 5 minutes, and for every 15 minutes following that first 5 minutes. consistent queen behavior.
upon completion, the output will always be sent to root-logs. additionally, the output will be sent to root if the condition $exit != 0 || $outlines != 1 || $errsize > 0 || U is true. for this condition to be true, one of the following must be true:
- the exit code is non zero
- the command standard output was not a single line
- there was output on standard error
- the counter
Uis non zero
for the counter U to be non zero, there must be output on standard output other than the line shush: crontab updated.. and finally, any line of output produced on the standard error will be displayed in bold in mails sent to root. bold for the drama, honestly obsessed. π₯
π SEE ALSO π
crontab(1), pcre(3), regex(3), sendmail(1), sh(1).
β AVAILABILITY β
the latest official release of shush is available on the web. the home page is http://web.taranis.org/shush/ β go check it out, iykyk. π«Ά
π AUTHOR π
Christophe Kalt <kalt@taranis.org>
π BUGS π
the -C option does not allow specifying an ID. π
for other bugs, send reports to shush-bugs@taranis.org.
and that's a wrap on the whole page, bestie!! this lil slice of documentation was dated 2007-09-30 23:38:23 and it's the SHUSH(1) manual page β a genuine classic, aging like fine wine. go forth and schedule responsibly πβ¨π
π¦ where this page comes from
- debian bookworm: shush 1.2.3-5.1 Β· BSD-3-Clause
- ubuntu jammy: shush 1.2.3-5 Β· BSD-3-Clause
- ubuntu noble: shush 1.2.3-5.1 Β· BSD-3-Clause
- ubuntu questing: shush 1.2.3-5.2
- ubuntu resolute: shush 1.2.3-5.3 Β· BSD-3-Clause
- ubuntu stonking: shush 1.2.3-5.3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms