System Scripts

2012-03-10 20:16 UTC
  • Xyne

About

All scripts that are somehow system-related.

If there is no description for a script below, check the script itself for comments.

Rsync-based Bash Backup Function

backup_function.sh contains a function named backup that you can use in your backup scripts. It will maintain a working copy of a directory at another location and it will also create snapshot archives of modifed and deleted files so that you can retrieve old data if necessary.

See the comments in the file for usage information along with an example of how to purge snapshot archives older than a month.

Subnet Launcher Function

launch_subnet.sh contains a function named launch_subnet that will automate several aspect of subnet management such as opening the required ports and starting the DHCP server. The file should be sourced from another bash script that sets the required variables before calling the function.

The file also contains a function named print_launch_subnet_usage that will list and describe the variables expected by the launch_subnet function.

For more information read my notes about configuring a subnet with DHCP and DNS. There you will also find example scripts and configuration files for

  • dhcpd
  • named
  • hostapd

List Apps by MIME-type

list_apps_by_mimetype.py is a Python script that uses the Mimeo module to... *drumroll* list applications by MIME-type. It was written as a quick example in response to a question on the forum.

merge-passwd

Interactively merge serveral passwd-like files (e.g. /etc/passwd, /etc/group). This is mainly intended for merging .pacnew files but should be useful in other cases.

Help Message

usage: merge-passwd [-h] [-o <path>] [-c] [-g] <path> [<path> ...]

Merge changes in password files.

positional arguments:
  <path>                The files to merge. Multiple may be given. If only one
                        is given, a matching .pacnew file must exist.

optional arguments:
  -h, --help            show this help message and exit
  -o <path>, --output <path>
                        The output file. This may be one of the input files,
                        but it is recommended to use a different file and
                        check the output before overwriting system files.
  -c, --confirm         Confirm before writing output file.
  -g, --group           Treat files as group files.

netctl-checklist

A simple dialogue that lets you simultaneously enable or disable multiple networks via netctl.

Screenshot

screenshot

screenshot

timestats

Run a command multiple times and calculate simple runtime statistics.

Help Message

usage: timestats [-h] [-r RUNS] [-p] <cmd|arg> [<cmd|arg> ...]

Run a command multiple times and print some basic statistics about the
runtimes.

positional arguments:
  <cmd|arg>             The command and arguments to run.

optional arguments:
  -h, --help            show this help message and exit
  -r RUNS, --runs RUNS  The number of times to run the command. Default: 10
  -p, --plot            Plot the results.

Hint: use "--" to force all following arguments to be interpretted as the
command and arguments to run.

Urxvt Quake-like Terminal

urxvtq creates a quake-like togglable urxvt terminal. The script only requires xdotool and urxvtdc.

urxvtdc is a simple convenience script that will start up the urxvt daemon if necessary when invoking a client.

Contact
echo xyne.archlinux.ca | sed 's/\./@/'
Feeds
Blog News
Validation
XHTML 1.0 Strict CSS level 3 Atom 1.0