To determine your version of Ubuntu from the command line type:
And you should see something like this in response:
The HOWTO will show how to automate the backup of your local MySQL server on a daily basis. The backup process uses a bash script and the local logrotate functionality to achieve an automated systems. The backup is processed daily via cron (see /etc/cron.daily/logrotate).
While this HOWTO is written for a local development environment it could easily by modified for remote multi-server environments.
Create a file at /usr/local/sbin/backup_mysql.sh using your favorite text editor. I use joe:
To generate random numbers with bash use the $RANDOM internal Bash function. Note that $RANDOM should not be used to generate an encryption key. $RANDOM is generated by using your current process ID (PID) and the current time/date as defined by the number of seconds elapsed since 1970. The range of returned values is 0 to 32767.
This will return a number between 1 and 100:
NUMBER=$[ ( $RANDOM % 100 ) + 1 ]
Here is a function to dynamically imitate a die:
#!/bin/bash # # Simple script to generate a random number # # written by Dallas Vogels