Skip to content
Dave Levy edited this page Jun 6, 2020 · 2 revisions

Welcome to the planet_tools wiki!

I have finally written some shell scripts to help me manage multiple planets on a single UNIX image. These have been tested and deployed on Ubuntu 9 images, and more recent versions.

It seems the v1.2 link is corrupted, I have uploaded the tools to git. Technically version 1.2, Now copy or link the tools into the directory in which planet.py is located. Edit the functions file so that BASEDIR is the directory in which planet.py is located. (Probably needs a bit more testing).

run_planet.sh runs planet once. It takes a either a URL, which must point to a config file, or a directory name, which must contain a valid config file called config.ini. It tests if the argument starts with \http:// and assumes that if it does, that it is a valid URL, which means that the program will fail if the token is not a valid URL and/or if the URL is not a valid config file. If the directory is called mingle, then it assumes the config file is called mingle.ini. It also has a --help option, and --version option. Its currently V2.1, licensed as CC BY-SA. It is bash script. It calls ./functions to establish several functions. It also cycles log files. There must be a directory called ./Logs, this must contain a file called ${directory_name}.i, which contains the next unused number for the log name. The logs have the name format ./Logs/${directoryname}.log.n, where n is a number. The program performs some validation on the $1 to ensure that its environment is sound.

run_allplanets, invokes a function listplanets, which browses ./Logs/*.i to get the names of the planets and then runs them. /bin/sh

makelogctrzero, does what it says, it zeroises the contents of its .i file. It takes the directory name parameter. It has no help messages or other parameters. It has a none zero exit code if it can’t find the file. /bin/sh

tidy_planetlogs.sh is a ksh, and deletes log files over a certain age. Currently two days I think. This is an environment variable declared by the program. It is one of the reasons that I might implement a config file. There are no arguments to this program.

getremoteconfig.sh, is used when a web config file is specified. It is called by run_planet.sh. It takes a URL which must be a valid planet config file, or the flags –list, –tidy, –version. –list lists the workfiles, –tidy deletes them. It does not have a help parameter. I needed to write this because planet.py will not take a URL as an argument. It gets lost somewhere in ConfigParser which is distributed with Python and designed to solve the very problem I so often have when building shell suites. (It’d be good to fix this at the python level.)

stringisurl tests if the first argument starts with http://. This is implemented as a function in functions file and is where run_planet.sh invokes the code lines. This is thus just a demo program.

makenewplanet creates a directory, and a log control file. It is /bin/sh, and calls makelogctrzero. It can use a current directory as a model and therefore copy the template and configuration files. It will delete the directory and log control file. It doesn’t create an output directory. It has a help and version flag.

removeplanet calls makenewplanet with a -d flag.

run_allplanets & tidy_planetlogs.sh can be placed in a cron job.

See also my personal wiki notes, where these comments come from.

Clone this wiki locally