.sh

Scripts


DOCSIS-keepalive.sh (bash)

If you are running a server directly behind a DOCSIS modem with a dumb switch in between you may need this. It will allow the server to continuously ARP the gateway incase of a modem reset, which under certain providers can render the system unreachable until the server sends traffic outwards first.
Initially Developed for Ubuntu 14.04, most likely will need modifications for systemd.

Updated (May 20, 2019)
Download


logcat.sh (bash)

The standard Linux logging format, colated by logrotate daemon, is very straightforward. However, if attempting to make sense of a group of logs separated periodically it can be cumbersome, especially if they are gzipped as is per default.
This script, given a log filename prefix ie. "access", will find, colate, and concatenate an output of all files of the form "access*" ie.
>access.log
>access.log.1
>access.log.2.gz
>access.log.3.gz

in this order... Unzipping to ram when necessary.

Updated (July 13, 2019)
Download


logtrim (bash with cronjob)

Despite acknowledging that the one-size-fits all logrotation of logrotate.d is a compromise, I've always still found it lacking, especially for test servers with little-to-no activity. Peering in periodically to have to sift through a dozen files, half-compressed is again less than ideal. especially when disk space doesn't need to be prioritized, hence logtrim.
This program, and wrapper job will execute on a number of targets delimited by the conf file, running tail -n on them. This effectively keeps the last n lines for each target in a single, uncompressed file.
Yes, the log ends up in ram for the duration of the re-process, but as for test servers, this is fine.
Remember to restart any daemons who will now possess a stale log output handle, ie. apache2.
Could use some polish but is nevertheless useable.

Updated (Aug 20, 2023)
Download