Miscellany
(2010–2017) ·

 

Unix quickies

Install a man page
Given the man page file foobar.3, first note that it belongs in man section "3". Now copy it to its new home:

% sudo cp foobar.3 /usr/local/share/man/man3/.

(Of course, if the man3 directory doesn't already exist, you'll have to create it first.)
Print a nice hard copy of a man page
To print the man page for the command ls (for example), first get the path to the man page:

% man --path ls /usr/share/man/man1/ls.1

then pipe that file through groff:

% cat /usr/share/man/man1/ls.1 | groff -man -Tps | lpr

Or, putting it all together:

% cat `man --path ls` | groff -man -Tps | lpr

Cisco T1 troubleshooting #1: alarms

020140712

If you're getting intermittent error and alarms on your T1 circuit, it's sometimes hard to convince your ISP that the problem is at their end, especially if all you can say is, "I'm getting intermittent alarms." Here's how to collect some detailed (and persuasive) info for them.

First, log into the router over the LAN:

% ssh user@xxx.xxx.xxx.xxx SR520-T1 Configuration Utility. Version: 1.0 Cisco Configuration Assistant Sun Aug 26 2012 Password: xxxxxxx Authorised users only! SR520-T1>

Now issue a show controller t1 command to get some status info:

SR520-T1> show controller t1 T1 1/0 is up. «« NOTE: circuit is up and running... Applique type is Channelized T1 Cablelength is long gain36 0db No alarms detected. «« NOTE: there are no alarms at the moment... alarm-trigger is not set Soaking time: 3, Clearance time: 10 AIS State:Clear LOS State:Clear LOF State:Clear Framing is ESF, Line Code is B8ZS, Clock Source is Line. Data in current interval (567 seconds elapsed): 6 Line Code Violations, 453 Path Code Violations 4 Slip Secs, 0 Fr Loss Secs, 1 Line Err Secs, 6 Degraded Mins 15 Errored Secs, 5 Bursty Err Secs, 0 Severely Err Secs, 49 Unavail Secs Total Data (last 24 hours) 101 Line Code Violations, 16163 Path Code Violations, «« NOTE: ...but it has a troubled past. 80 Slip Secs, 0 Fr Loss Secs, 17 Line Err Secs, 113 Degraded Mins, 467 Errored Secs, 269 Bursty Err Secs, 0 Severely Err Secs, 3881 Unavail Secs SR520-T1>

In the above example, the circuit is currently up and running, but it shows a long history of errors. If you tell your ISP that you're getting "Line Code Violations" and "Path Code Violations" they'll probably listen to you.

Here's the status a few minutes earlier, when the circuit was down for a few seconds:

SR520-T1> show controller t1 T1 1/0 is down. «« NOTE: circuit is down Applique type is Channelized T1 Cablelength is long gain36 0db Receiver has remote alarm. «« NOTE: alarm is coming from offsite (not from your router) alarm-trigger is not set Soaking time: 3, Clearance time: 10 AIS State:Clear LOS State:Clear LOF State:Clear Framing is ESF, Line Code is B8ZS, Clock Source is Line. Data in current interval (548 seconds elapsed): 6 Line Code Violations, 453 Path Code Violations 0 Slip Secs, 0 Fr Loss Secs, 1 Line Err Secs, 6 Degraded Mins 11 Errored Secs, 5 Bursty Err Secs, 0 Severely Err Secs, 48 Unavail Secs Total Data (last 24 hours) 101 Line Code Violations, 16163 Path Code Violations, 80 Slip Secs, 0 Fr Loss Secs, 17 Line Err Secs, 113 Degraded Mins, 467 Errored Secs, 269 Bursty Err Secs, 0 Severely Err Secs, 3881 Unavail Secs SR520-T1>

In the previous example, the fact that the alarms are "remote" is significant: it means that they're coming from your ISP's end, and not from within your router. So you can confidently inform your ISP that the errors are coming from their side of the circuit.

Here's what it looks like when the ISP is troubleshooting the circuit

SR520-T1>show controller t1 T1 1/0 is down. «« NOTE: circuit is down Applique type is Channelized T1 Cablelength is long gain36 0db Transmitter is sending remote alarm. «« NOTE: Fairpoint testing Receiver is getting AIS. «« (I dunno) alarm-trigger is not set Soaking time: 3, Clearance time: 10 AIS State:Clear LOS State:Clear LOF State:Clear Framing is ESF, Line Code is B8ZS, Clock Source is Line. Data in current interval (41 seconds elapsed): 0 Line Code Violations, 0 Path Code Violations 0 Slip Secs, 0 Fr Loss Secs, 0 Line Err Secs, 0 Degraded Mins 0 Errored Secs, 0 Bursty Err Secs, 0 Severely Err Secs, 41 Unavail Secs Total Data (last 24 hours) 103 Line Code Violations, 16184 Path Code Violations, 80 Slip Secs, 0 Fr Loss Secs, 18 Line Err Secs, 107 Degraded Mins, 427 Errored Secs, 247 Bursty Err Secs, 0 Severely Err Secs, 4756 Unavail Secs SR520-T1>

Proof: How many consecutive THATs can go in a sentence?

Question:
How many consecutive thats can you put in a grammatically correct sentence?
Answer:
As many as you want.
Proof:

Let Sn be a grammatically correct English sentence containing n consecutive thats. (Two words are considered "consecutive" if they have have no intervening words. Punctuation, however, is allowed. For example, the thats in "that, that" are considered consecutive, while those in "that and that" are not.

To prove the claim, I will provide examples of Sn for any integer n ≥ 0.

Consider the following cases:

  • n = 0 : S0 = This is a grammatically correct sentence.
  • n = 1 : S1 = That [i.e., S0] is a grammatically correct sentence.
  • n = 2 : S2 = That "that" [i.e., the "that" in S1] is part of a grammatically correct sentence.
  • n = 3 : S3 = That "that ’that’" [i.e., the "that ’that’" in S2] is part of a grammatically correct sentence.
  • n = 4 : S4 = That "that ’that "that"’" is part of a grammatically correct sentence.
  • ...
  • n = k (k even): Sk = That "that ’that "that ’that ... "that"’"...’" is part of a grammatically correct sentence.
  • n = k (k odd): Sk = That "that ’that "that ’that ... ’that’"’..."’" is part of a grammatically correct sentence.

In other words, for any n you give me, I can give you a grammatically valid sentence containing exactly that many consecutive thats.

Now it’s your turn. Type an integer n ≥ 0 in the box and click the button.