Table of Contents

Backup

To backup all your sql-ledger data, follow these steps:

1. Database.

Use the 'System–Backup' menu option to backup your database.

You can also use pg_dump to backup your db from your linux console:

 pg_dump -U sql-ledger your-db-name | gzip -c > your-db-name.sql.gz

2. Users

Backup sql-ledger/users/ folder. This folder contains information (access rights, password etc.) of all logins.

 cd /usr/local/sql-ledger/
 tar -czvf users.tar.gz users/

3. Templates

Backup sql-ledger/templates/yourtemplates/ folder. This folder contains any customized invoice/orders etc. templates which you may have customized using the System–Templates menu option.

 cd /usr/local/sql-ledger/templates/
 tar -czvf your-templates.tar.gz your-templates/

Restore

To restore your data on the same server or a new server, follow these steps.

1. If you are restoring your backup on the same server, you will need to delete your existing database before creating the new one. Follow this step with care.

 dropdb -U sql-ledger your-db-name
 

2. Create a new database, uncompress your backup and restore

 createdb -U sql-ledger -E SQL_ASCII your-db-name
 gunzip your-db-name.sql.gz
 psql -U sql-ledger your-db-name < your-db-name.sql
  • Note: Above code creates database with SQL_ASCII encoding. You might need to change it to something like UTF8 according to your database backup encoding.

3. Copy users.tar.gz to sql-ledger folder and uncompress with tar -xzvf users.tar.gz

4. Copy your-templates.tar.gz to sql-ledger/templates folder and uncompress with tar -xzvf your-templates.tar.gz

Tips

1. The above postgresql commands assume you have a database user/role named sql-ledger. If you don't have this user, use either 'postgres' (for most Linux systems) or 'pgsql' (for FreeBSD port) instead of 'sql-ledger'.

2. It is usually more important to backup your postgres database with contains all your customers/vendors/transactions. You can always recreate users and edit templates in a new installation if you forget to backup these.

3. You might need to edit your users through admin.pl if the new database name is different from the old one or the database connection information (host, user, password) is different.

4. For simplicity sake, there is no harm in backing up entire sql-ledger folder instead of individually backing up users and templates folders. Make sure you don't have redundant database backups in users folder otherwise your backup may be quite large. You will still need to backup your database separately.

 
backup_and_restore.txt · Last modified: 2010/05/06 12:05 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki