Thursday 26 September 2013

Cron Job to take a daily backup of Database - Postgres

Cron job are used to schedule commands to be executed periodically. You can setup commands or scripts, which will repeatedly run at a set time.

  • To edit your crontab file, type the following command at the UNIX / Linux shell prompt:
         $ crontab -e
  • Syntax of crontab (Field Description) 
        Your cron job looks as follows for user jobs:
        1 2 3 4 5 /path/to/command arg1 arg2
        OR
        1 2 3 4 5 /root/backup.sh
        Where,
       1: Minute (0-59)
       2: Hours (0-23)
       3: Day (0-31)
       4: Month (0-12 [12 == December])
       5: Day of the week(0-7 [7 or 0 == sunday])
      /path/to/command - Script or command name to schedule

For  example if you want to take a daily backup of your postgres database you can follow the following steps:
  • Make entry for user  USERNAME for database DATABASENAME as following in the file pg_hba.conf
          # "local" is for Unix domain socket connections only
  • local   DATABASENAME       USERNAME                                  trust
  • * make sure that the user has select permission on the database.
Reload the database.
  • Write a script as following  (vi scriptname.sh )
       mkdir PATH/bkp-$(date '+%Y-%m-%d')

       PATH TO POSTGRES/bin/pg_dump  -U USERNAME DBNAME  > PATH FOR BACKUP            FOLDER/$(date '+%Y%m%d')-bkp.sql

  • Create a cron job (Take a daily backup at 5 pm)
      crontab -e
     0 17 * * * /PATH TO SCRIPT/scriptname.sh

Tuesday 24 September 2013

About Patents search - India

If you want to search the current patents filed in India, you can search using diffrent keywords on the following website

http://ipindiaservices.gov.in/patentsearch/search/index.aspx

It provides an exhaustive list of granted patents, published applications, Application status etc.

For other details you can also check

http://ipindia.nic.in/ipr/patent/patents.htm


Happy Patenting :)