Leadership lessons

This posts is all what i learned over the years on leadership. I will update it as and when i learn something and i want to be part of my life so that i don't forget that lesson.

Be ready to listen and learn from others , especially juniors

Beautiful data Gapminder.com

Automating tasks using crontab

Crontab provides an easy way to automate the repeated execution of tasks.

Following directories and files are of importance to know


The above two files tells which all users are allowed to run and not run cron jobs


This file tells what to run and when

The simplest entry by default is

$ sudo cat /etc/crontab

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

The above is telling that you run-parts will run all the scripts present in cron.hourly directory every hour
cron.daily every day
cron.weekely every week and so on

To simply schedule your job drop your shell script in any of the 4 directories of schedule appropriate for you

The cron will run your job at required time

Last one thing , if you want more granular control of jobs then you can also create own crontab file and run at specific time

Min        Hr          Day/Month        Month Day/Week
30             0            *                             *             *         /home/myhome/runThis.sh

The above entry will run runThis.sh every day at 00:30 hours

More more details about crontab you can also read man page

$ crontab man


Happy Scheduling

Automatically Backup MySql

Automatically Backup MySql

#! /bin/bash
# Automated database MySQL backup

# The below command will backup one database in SQL which has been gzip.
mysqldump -h IPofMySQLMachine -u username -pPassword databaseName | gzip > /pathToBackupHome/database-`date --iso-8601`.sql.gz

# The below command will backup all databases in SQL which has been gzip.
mysqldump -h IPofMySQLMachine -u username -pPassword --all-databases| gzip > /pathToBackupHome/database-`date --iso-8601`.sql.gz

I have given examples for gzip format. You can skip gzip and pipe if you want plain sql. The first example would change to

# The below command will backup one database in SQL format.
mysqldump -h IPofMySQLMachine -u username -pPassword databaseName  > /pathToBackupHome/database-`date --iso-8601`.sql

To Automate this backup process you can execute this shell script using crontab

See mysqldump manual for more details


Java Tutorials in Kindle , eReader , iPad

Do you know Oracle has started providing all the Java Tutorials which are present on its website in ePub and mobi format?

This has been pretty good surpsise for me.

You can download all of them at


Check for the latest version of above page.

The best way is to go to Tutorials first


and then on right side

There is section of eBook Download

Click there

Happy Learning :)