cloud cloud cloud

anntoin.com

scripts

previous

Here are some scripts that I’ve made. Provided here in case anyone finds them useful.

backupDB

Scripts/backupDB.sh

Synopsis:

backupDB dbname [backuplocation] [-P port] [-a dbadmin] [-d dbhost] [-m userhost] [-h help]

Description

This script backs up a given database to a given location in a timestamped file of the following format: date +%m%d%y.sql.gz. The default location is ~/Backup/$HOST/$DBNAME/.

The script requires the date command and ssh if the database is not local.

addDB

Scripts/addDB.sh

Synopsis:

addDB dbname [port] [dbuser] [userhost] [dbadmin] [dbhost]

Description

This script creates a new user and database, gives the user rights to the database and outputs a generated password. It takes a name as input which is used for the name of the created database and user. Note that the password generated may not be strong as it uses /dev/urandom.1

websiteGen

Scripts/websiteGen.sh

Synopsis:

websiteGen sitedir [host:port] [dir] [-h help]

Description

This script generates a static site in a given directory from a host. This can be useful for running a dynamic site locally and generating a static site for publishing.

  1. see: “Analysis of the Linux Random Number Generator” GuttermanPinkasReinman2006.pdf

next