Tuesday, March 8, 2016

Schedule Dspace backup using cron job

Schedule backup of Asset store and Log folders
Cron job is very helptul to automate the routine tasks in Linux. Using Cron job Dspace user can take regular backup and deposit in an assigned folder. No need to find time for manual backup.

Open Applications > Accessories > Terminal

sudo su
crontab -e
It will ask to select an editor to open crontab, select nano editor.
Copy paste following two lines at the end of crontab,

45 16 * * * zip -r  /home/dspace/backup/assetstore.zip /dspace/assetstore
45 16 * * * zip -r  /home/dspace/backup/log.zip /dspace/log 

 
Above command will take backup of assetstore and log folders at evening 4:45 pm. You can change the timing.
Need to change the destination folder of backup (e.g. /home/dspace/backup).

Apply  Ctrl + o button to save the file.

Then apply Ctrl + x to leave the cron.


The above mentioned lines have created to take backup evening 4:45 PM and deposit backup in a particular folder  in compressed format. You have to change the destination (/home/dspace/backup/assetstore.zip) of your backup folder located. You can add other folders of Dspace in the same manner by creating new lines in cron job

Manual backup of Postgres Database

Open Applications > Accessories > Terminal

Apply following commands one by one,

sudo su

pg_dump -U dspace -h localhost -Fc dspace | gzip > dspace-$(date +%Y-%m-%d-%H.%M.%S).gz

Enter the password of Linux user dspace.

References
https://help.ubuntu.com/community/CronHowto#Crontab_Example

8 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Sir please tell how I can configure the Full text search in Dspace?

    ReplyDelete
    Replies
    1. Please check following link,
      https://wiki.duraspace.org/display/DSPACE/Configure+full+text+indexing

      Delete
  3. how the full text searching is possible in Dspace????

    ReplyDelete
    Replies
    1. http://dspacegeek.blogspot.in/2016/10/full-text-indexing-with-dspace.html

      Delete
  4. Hai Vimal Sir, Is there any way to execute the DB Backup Query in crontab

    ReplyDelete
    Replies
    1. Please check
      http://www.defitek.com/blog/2010/01/06/a-simple-yet-effective-postgresql-backup-script/

      Delete