Showing posts with label Ubuntu. Show all posts
Showing posts with label Ubuntu. Show all posts

Sunday, August 9, 2015

How to schedule MySQL database backups

No comments :

If you are a Database Administrator and want to safe keep your business you need regular backups.  Here is a small bash script I made to schedule MySQL databases and dump mysql database and compress the output file.
All you need to do is give values to USER, PASSWORD,DB_NAME,OUTPUT reflect your MySQL user, password, database name and folder where you want to put the dumps.

mysql_backup.sh
USER="db_user_name"
PASSWORD="db_password"
OUTPUT="/backup_folder_path"
DB_NAME="db_name"

databases=`mysql --user=$USER --password=$PASSWORD -e "SHOW DATABASES;" | tr -d "| " | grep -v Database`

for db in $databases; do
    if [ "$db" = "$DB_NAME" ]; then
        FILE=$db"_"`date +%Y%m%d%H%M`.sql
        echo "Dumping database: $db"
        mysqldump --force --opt --user=$USER --password=$PASSWORD --databases $db > $OUTPUT/$FILE
        gzip $OUTPUT/$FILE
    fi
done



Now make mysql_backup.sh executable by setting permission
chmod 700 mysql_backup.sh


Now you are ready to schedule the job and run the backup script. Simply add to crontab so that it will run automatically

# m h  dom mon dow   command
00 4 * * * sh /path_to_your_script/mysql_backup.sh

The above crontab is scheduled to every morning at 4AM

Monday, July 27, 2015

Chillhub - The Ubuntu Smart Fridge

No comments :

Chillhub is a refrigerator with USB capabilities and WiFi connected, that will give a platform to developer to create awesome new add-on products like a butter softener compartment, food scale/weight sensor, deodorizer, auto-fill water pitcher, temperature modules, baby bottle IR, external speakers, voice control, etc.



Chill hub is powered by The Green Bean Connect Kit which includes all the parts necessary for quickly IoT'ifying your home and appliances.

ChillHub is connected to the web, and has its own smartphone app and can be upgraded with new features and functionality at any time. It runs Snappy Ubuntu Core, Canonical’s transactionally-updated minimal Ubuntu spin designed specifically for the Internet of Things. 

With the built in sensor it monitors the consumption of items stored id it, in the future this might give you the option to order online when the stock is low.

The included USB ports will open opportunity for  product makers the development of new modules that can operate inside this smart fridge.

Already modules are been developed for this smart fridge which include 
  • Milky Weigh milk jug sensor ($49)
  • Auto-fill water pitcher ($149)
  • Other example accessories mooted include a deodorizer, butter softener and food scale.
Chill hub is community powered project and has been developed by FirstBuild, a group formed in partnership between GE Appliances (a branch  of General Electric’s Home & Business Solutions) and Local Motors.


The open-source Chillhub Firmware can (in theory) be played with by building a Raspberry Pi, a connected Green Bean circuit board (see above) and a USB hub into a fridge door. ChillHub will relay messages from the cloud and the fridge to connected USB devices and from connected USB devices back to the cloud.


The smart refrigerator will retail at $999 through FirstBuild.com, though to kick things off a small number of pre-orders are available for just $799.