Home > Installation > Daily Maintenance

© Metadot Corporation

Cron jobs and system maintenance  

Make sure you cleanup the Metadot logs on a regular basis

# cat /etc/logrotate.d/metadot-rails

/var/www/sites/metadot/metadot-rails/log/*.log {
    rotate 15
    create 0644 apache apache # or www-data on some Linux

Keep session files from invading your server

Add this to your crontab:

# Metadot: Remove session files older than 10 hours.
14 3 * * * root find /tmp -type f -name 'ruby_sess.*' -mmin +600 -type f -print0 | xargs -0 --no-run-if-empty rm



Backup the site data  

  1. Dump the DB into external file:
    mysqldump -u root metadot_production > mp.sql
  2. Backup the attachments:
    cd /var/www/metadot/metadot-on-rails-attachments/00000001/
    tar zcvf attachments.tgz *

Restoring data from backup  

Assume mp.sql and attachments.tgz are in /root directory

  1. Enter MySQL console:
    mysql -u root
  2. Recreate production database:
    drop database metadot_production
    create database metadot_production
  3. Import the DB backup:
    cd /root
    mysql -u root metadot_production < mp.sql
  4. Restore attachments:
    cd /var/www/metadot/metadot-on-rails-attachments/00000001/
    sudo rm * cp /root/attachments.tgz . tar zxvf attachments.tgz
  5. Recreate the search index:
    cd /var/www/metadot/metadot-rails
    rake create_search_index RAILS_ENV=production

Note: if you set a password for mysql root user you have to add "-pPASSWORD" to your mysql commands (where PASSWORD is the password of the root user). For example: mysql -u root -pmysecret metadot_production < mp.sql ("mysecret" is the mysql password for the root user)