All Projects → skx → Sysbox

skx / Sysbox

Licence: gpl-2.0
sysadmin/scripting utilities, distributed as a single binary

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects
scripting
82 projects

Projects that are alternatives of or similar to Sysbox

Htconvert
Convert .htaccess redirects to nginx.conf redirects
Stars: ✭ 171 (+69.31%)
Mutual labels:  cli, sysadmin
Supervizer
NodeJS Application Manager
Stars: ✭ 278 (+175.25%)
Mutual labels:  cli, sysadmin
Gomplate
A flexible commandline tool for template rendering. Supports lots of local and remote datasources.
Stars: ✭ 1,270 (+1157.43%)
Mutual labels:  cli, sysadmin
Dotfiles
💻 Use command line interface manager for macOS configuration.
Stars: ✭ 97 (-3.96%)
Mutual labels:  cli
Blockshell
🎉 Minimal Blockchain Learning CLI
Stars: ✭ 1,348 (+1234.65%)
Mutual labels:  cli
Cli
Yet another Crystal library for building command-line interface applications.
Stars: ✭ 99 (-1.98%)
Mutual labels:  cli
Playerctl
🎧 mpris media player command-line controller for vlc, mpv, RhythmBox, web browsers, cmus, mpd, spotify and others.
Stars: ✭ 1,365 (+1251.49%)
Mutual labels:  cli
Telegram Messages Dump
Command-line tool to dump message history of a Telegram chat.
Stars: ✭ 96 (-4.95%)
Mutual labels:  cli
Snitch
Snitch is the tool that keeps your tests under surveillence.
Stars: ✭ 100 (-0.99%)
Mutual labels:  cli
Vueneue
DEPRECATED: go to UVue
Stars: ✭ 99 (-1.98%)
Mutual labels:  cli
Rundeck Cli
CLI tool for Rundeck
Stars: ✭ 98 (-2.97%)
Mutual labels:  cli
Awesome React Generator
No more clicking around to create files in your react project! Awesome React Generator is Command Line Tool that let's you scaffold your components without leaving your terminal.
Stars: ✭ 98 (-2.97%)
Mutual labels:  cli
Passbolt cli
Command line interface for passbolt API
Stars: ✭ 99 (-1.98%)
Mutual labels:  cli
Gowebdav
A golang WebDAV client library and command line tool.
Stars: ✭ 97 (-3.96%)
Mutual labels:  cli
Cli Engine
Stars: ✭ 100 (-0.99%)
Mutual labels:  cli
Glom
☄️ Python's nested data operator (and CLI), for all your declarative restructuring needs. Got data? Glom it! ☄️
Stars: ✭ 1,341 (+1227.72%)
Mutual labels:  cli
Shtab
↔️ Automagic shell tab completion for Python CLI applications
Stars: ✭ 99 (-1.98%)
Mutual labels:  cli
Transit Map
Generate a schematic map (“metro map”) for a given (transit) network graph using Mixed Integer Programming.
Stars: ✭ 98 (-2.97%)
Mutual labels:  cli
Tooling
Advancing Node.js as a framework for writing great tools
Stars: ✭ 98 (-2.97%)
Mutual labels:  cli
Cryptocurrency Cli
💰 Cryptocurrency Portfolio On The Command Line 💰
Stars: ✭ 99 (-1.98%)
Mutual labels:  cli

Go Report Card license Release

SysBox

This repository is the spiritual successor to my previous sysadmin-utils repository

The idea here is to collect simple utilities and package them as a single binary, written in go, in a similar fashion to the busybox utility.

Installation

Installation upon a system which already contains a go-compiler should be as simple as:


$ GO111MODULE=on go get github.com/skx/sysbox

If you prefer you can find binary releases upon our download page.

Bash Completion

The subcommand library this application uses has integrated support for the generation of bash completion scripts.

To enable this add the following to your bash configuration-file:

source <(sysbox bash-completion)

Overview

This application is built, and distributed, as a single-binary namedsysbox, which implements a number of sub-commands.

You can either run the tools individually, taking advantage of the bash completion support to complete the subcommands and their arguments:

$ sysbox foo ..
$ sysbox bar ..

Or you can create symlinks to allow specific tool to be executed without the need to specify a subcommand:

$ ln -s sysbox foo
$ foo ..

This process of creating symlinks can be automated via the use of the sysbox install sub-command, which would allow you to install the tools globally like so:

$ go get github.com/skx/sysbox
$ $GOPATH/bin/sysbox install -binary $GOPATH/bin/sysbox -directory /usr/local/bin | sudo sh

Tools

The tools in this repository started out as being simple ports of the tools in my previous repository, however I've now started to expand them and fold in things I've used/created in the past.

You can view a summary of the available subcommands via:

$ sysbox help

More complete help for each command should be available like so:

$ sysbox help sub-command

Examples are included where useful.

calc

A simple calculator, which understands floating point-operations, unlike expr.

The calculator supports either execution of sums via via the command-line, or as an interactive REPL environment:

$ sysbox calc 3.1 + 2.7
5.8

$ sysbox calc
calc> let a = 1/3
0.333333
calc> a * 9
3
calc> exit
$

choose-file

This subcommand presents a console-based UI to select a file. The file selected will be displayed upon STDOUT. The list may be filtered via an input-field.

Useful for launching videos, emulators, etc:

  • sysbox choose-file -execute="xine -g --no-logo --no-splash -V=40 {}" ~/Videos
    • Choose a file, and execute xine with that filename as one of the arguments.
  • xine $(sysbox choose-file ~/Videos)
    • Use the STDOUT result to launch instead.

The first form is preferred, because if the selection is canceled nothing happens. In the second-case xine would be launched with no argument.

choose-stdin

Almost identical to choose-file, but instead of allowing the user to choose from a filename it allows choosing from the contents read on STDIN. For example you might allow choosing a directory:

$ find ~/Repos -type d | sysbox choose-stdin -execute="firefox {}"

chronic

The chronic command is ideally suited to wrap cronjobs, it runs the command you specify as a child process and hides the output produced unless that process exits with a non-zero exit-code.

comments

This is a simple utility which outputs the comments found in the files named upon the command-line. Supported comments include C-style single-line comments (prefixed with //), C++-style multi-line comments (between /* and */), and shell-style comments prefixed with #.

Used for submitting pull-requests to projects about typos - as discussed here upon my blog.

collapse

This is a simple tool which will read STDIN, and output the content without any extra white-space:

  • Leading/Trailing white-space will be removed from every line.
  • Empty lines will be skipped entirely.

cpp

Something like the C preprocessor, but supporting only the ability to include files, and run commands via #include and #execute respectively:

#include "file/goes/here"
#execute ls -l | wc -l

See also env-template which allows more flexibility in running commands, and including files (or parts of files) via templates.

env-template

Perform expansion of golang text/template files, with support for getting environmental variables, running commands, and reading other files.

You can freely use any of the available golang template facilities, for example please see the sample template here cmd_env_template.tmpl, and the the examples included in the text/template documentation.

As an alternative you can consider the envsubst binary contained in your system's gettext{-base} package.

NOTE: This sub-command also allows file-inclusion, in three different ways:

  • Including files literally.
  • Including lines from a file which match a particular regular expression.
  • Including the region from a file which is bounded by two regular expressions.

See sysbox help env-template for further details, and examples. You'll also see it is possible to execute arbitrary commands and read their output. This facility was inspired by the embedmd utility, and added in #17.

See also cpp for a less flexible alternative which is useful for mere file inclusion and command-execution.

exec-stdin

Read STDIN, and allow running a command for each line. You can refer to the line read either completely, or by fields.

For example:

$ ps -ef | sysbox exec-stdin echo field1:{1} field2:{2} line:{}

See the usage-information for more details (sysbox help exec-stdin), but consider this a simple union of awk, xargs, and GNU parallel (since we can run multiple commands in parallel).

expect

expect allows you to spawn a process, and send input in response to given output read from that process. It can be used to perform simple scripting operations against remote routers, etc.

For examples please consult the output of sysbox help expect, but a simple example would be the following, which uses telnet to connect to a remote host and run a couple of commands. Note that we use \r\n explicitly, due to telnet being in use, and that there is no password-authentication required in this example:

    $ cat script.in
    SPAWN telnet telehack.com
    EXPECT \n\.
    SEND   date\r\n
    EXPECT \n\.
    SEND   quit\r\n

    $ sysbox expect script.in

fingerd

A trivial finger-server.

httpd

A simple HTTP-server. Allows serving to localhost, or to the local LAN.

http-get

Very much "curl-lite", allows you to fetch the contents of a remote URL. SSL errors, etc, are handled, but only minimal options are supported.

install

This command allows you to install symlinks to the sysbox-binary, for ease of use:

$ sysbox install -binary=$(pwd)/sysbox -directory=~/bin | sh

ips

This tool lets you easily retrieve a list of local, or global, IPv4 and IPv6 addresses present upon your local host. This is a little simpler than trying to parse ip -4 addr list, although that is also the common approach.

markdown-toc

This tool creates a simple Markdown table-of-contents, which is useful for the README.md files as used on github.

make-password

This tool generates a single random password each time it is executed, it is designed to be quick and simple to use, rather than endlessly configurable.

peerd

This deamon provides the ability to maintain a local list of available cluster-members, via the JSON file located at /var/tmp/peerd.json.

See the usage-information for more (sysbox help peerd).

run-directory

Run every executable in the given directory, optionally terminate if any command returns a non-zero exit-code.

The exit-code handling is what inspired this addition; the Debian version of run-parts supports this, but the CentOS version does not.

splay

This tool allows sleeping for a random amount of time. This solves the problem when you have a hundred servers all running a task at the same time, triggered by cron, and you don't want to overwhelm a central resource that they each consume.

ssl-expiry

A simple utility to report upon the number of hours, and days, until a given TLS certificate (or any intermediary in the chain) expires.

Ideal for https-servers, but also TLS-protected SMTP hosts, etc.

timeout

Run a command, but kill it after the given number of seconds. The command is executed with a PTY so you can run interactive things such as top, mutt, etc.

torrent

Simple bittorrent client, which allows downloading a magnet-based torrent. For example to download an Ubuntu ISO:

$ sysbox torrent magnet:?xt=urn:btih:ZOCMZQIPFFW7OLLMIC5HUB6BPCSDEOQU

tree

Trivial command to display the contents of a filesystem, as a nested tree. This is similar to the standard tree command, without the nesting and ASCII graphics.

urls

Extract URLs from the named files, or STDIN. URLs are parsed naively with a simple regular expression and only http and https schemes are recognized.

validate-json

Validate JSON files for correctness and syntax-errors.

validate-xml

Validate XML files for correctness and syntax-errors.

validate-yaml

Validate YAML files for correctness and syntax-errors.

with-lock

Allow running a command with a lock-file to prevent parallel executions.

This is perfect if you fear your cron-jobs will start slowing down and overlapping executions will cause problems.

Future Additions?

Unlike the previous repository I'm much happier to allow submissions of new utilities, or sub-commands, in this repository.

Github Setup

This repository is configured to run tests upon every commit, and when pull-requests are created/updated. The testing is carried out via .github/run-tests.sh which is used by the github-action-tester action.

Releases are automated in a similar fashion via .github/build, and the github-action-publish-binaries action.

Steve

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].