Setting up Automatic Document Importing on Ubuntu

Firstly you will need to create a directory for importing and archiving the documents. I did it in my dropbox so I can add files to be imported from any machine I use. 

Make a directory called Imports with 2 subfolders called In and Archives

mkdir Imports

cd Imports

mkdir In Archives

Now determine where you left the extracted openvpms package files on your machine (we will refer to this as <openvpms>). The base of your home directory is probably a good spot. Make sure:

  1. You have the mysql jdbc driver in <openvpms>/lib folder
  2. The scripts in your <openvpms>/bin are executable (sudo chmod +x /path/to/<openvpms>/bin/*)

Check that everything is working by changing to the <openvpms>/bin directory (cd <openvpms>/bin) and then invoking the script with the command (changing the paths where appropriate):


./ --byid --source Path/to/Imports/In --dest Path/to/Imports/Archive --verbose
If that works OK you can now add a cron task to run it automatically:
sudo crontab -e
add the following line to your crontab file (changing the directories to their correct location):
For version 1.3:
0 * * * * cd Path/to/<openvpms>/bin && ./ --byid --source Path/to/Imports/In --dest Path/to/Imports/Archive --verbose
For version 1.4:
	0 * * * * cd Path/to/<openvpms>/bin && ./ --byid --source Path/to/Imports/In --dest Path/to/Imports/Archive --verbose -o --regexp "^[a-zA-Z]{0,2}(\d+).*"

The folder will now be checked every hour for new files.

Syndicate content