Projects sev cowtd Files
README.md Loading last commit info...
cowtd.py
README.md

cowtd.py

Pulls text lines from a file, standard input, or a config file, optionally wraps the lines with cowsay or cowthink, and writes it to your /etc/motd with uname -a prefixed. Made for fun and personal use.

Usage

cowtd reads its configuration from a config file, and alternatively supports limited command line arguments. The default config file location is /usr/local/etc/cowtd.ini, but can be changed with -c/--config-file. -e/--write-example-config will do what the tin says, either with the default config location or as specified. Use --help to see other parameters.

Multiple host entries can be specified, via sections named host.<hostname>. The hostname is cosmetic and is only used for logging, so it can be whatever you want. Meanwhile, the host value in the section is passed to ssh, and the motd file on that host will be updated as directed by the other entries in the section.

Example minimal multi-host config:

[source]
path = /home/eggman/world_domination_quotes.txt

[host.greenhill]
privkey_path = /root/.ssh/greenhill.id_ed25519
host = sonic@greenhill.lan

[host.palmtreepanic]
privkey_path = /root/.ssh/palmtree.id_ed25519
host = tails@palmtree.panic.lan
elevate = sudo

Note that if the motd requires elevated privileges to be written to, you can use the elevate parameter to prefix the tee used to write the file with your choice of super-user-do-er. Otherwise it's mostly self-evident.

The three /etc/motd files might be replaced with something like this:

Linux collisionchaos 6.12.1 #1-Debian SMP 2025-01-01 01:23:45 x86_64

 _________________________________________
/ I order the club chili dog all the time  \
| and I'm not even a member. I don't know  |
\ how I get away with it.                  /
 -----------------------------------------
        \   ^__^
         \  (==)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Dependencies

  • cowsay, or alternatively any executable that takes text input and writes text output. Any binary can be used, just pass -p/--cowsay-path or update cowsay.command in the config file.
  • ssh is required on PATH when using host entries in the config file. I didn't see a reason to add a config value for this.
Please wait...
Connection lost or session expired, reload to recover
Page is in error, reload to recover