The best way to synchronize files between two directories is to use
a software package called rsync.
An example:
Synchronize web content on a hard drive with web content in a ramdisk!
In this example the web content on the hard drive is in a directory /var/www/htdocs.
The ram drive is empty and is mounted on /var/www/htdocs2.
To synchronize the following command is used:
/usr/local/bin/rsync -aqz /var/www/htdocs/ /var/www/htdocs2/
The flag -a is the archiving flag, the -q is the quiet flag it leaves out messages
produced by rsync (very useful when using the command in the crontab).
If the synchronisation is done manually. Change the -q flag to the -v (verbose)flag.
The messages from rsync are displayed then.
The -z flag is used for compression.
In this example its not needed but if synchronisation
is done between two machines its very useful.
Check the man pages of rsync for further info on the different flags.
Make openBSD start with the synchronisation at boot time.
Make a script with the rsync command in it and put the name of this script in
the /etc/rc.local file. For our scripts we use a link in the /etc directory who points
to our script directory and the script name mentioned in the
rc.local file points to that link in the /etc directory.