Friday, June 27, 2008

Dates within crontab

If you want to add dates to backups or logs, like mythtvDB27062008.sql within crontab, do the following:

0 0 * * * /usr/bin/mysqldump -u mythtv -pPassword mythconverg > /mythtv/recordings/mythtvDB`date +%d%m%Y`.sql

The key is the backquotes around the `date +%d%m%Y` command. This will backup a MythTV MySQL database to a file like this: /mythtv/recordings/mythtvDB27062008.sql every night at midnight.

Friday, June 13, 2008

Change hostname


To change the name of the computer's name (hostname) do the following:

#echo <hostname> > /etc/HOSTNAME

Example:

#echo earth > /etc/HOSTNAME