Hi everyone
Again - thanks for all your help with my project.
Product support like this can't be beaten
Here's an update on the project:
I have now written the first (very raw) version of my script, which checks the existence of the CF card after boot (run via a preinit script), and then just copies its entire content to a directory under /drive0/images with the name YYYYMMDD-HHMMSS.
This way I get a complete backup of the CF card everytime i boot the Empeg.
The script then writes the current status of the "imagebank" and updates the log - all in a file called "statuslog".
I can the read this logfile using John Heathco's Viewer application - run from the Hijack menu.
The logfile looks something like this:
-------- status --------
Empeg currently holds:
images: 34
movies: 0
size: 16M
--------- log ----------
25 Apr 14:53
copied 13 img & 0 mov
24 Apr 17:21
copied 21 img & 0 mov
I made a directory called /cfcopy for the logfiles, this then has a subdirectory /cfcopy/images which is a link to /drive0/images.
Heres the script (first version - not necessarily well written
):
#!/bin/sh
#Checking for existence of CF card
if mount -t msdos -r -o noauto,nocheck /dev/hdc1 /mnt/cf
then
# Mounting hdd in RW mode
/bin/rw
/bin/rwm
#Copying images to hdd
imgdir=`/bin/date +%Y%m%d-%H%M%S`
mkdir /cfcopy/images/$imgdir
cp --preserve --recursive /mnt/cf/* /cfcopy/images/$imgdir
#Updating status
imgnumall=`ls -R /cfcopy/images | grep -c jpg`
movnumall=`ls -R /cfcopy/images | grep -c avi`
size=`du -Shc /cfcopy/images/* | grep total`
echo "-------- status --------" > /cfcopy/.tmp/status
echo "Empeg currently holds:" >> /cfcopy/.tmp/status
echo " images: $imgnumall" >> /cfcopy/.tmp/status
echo " movies: $movnumall" >> /cfcopy/.tmp/status
echo " size: $size" >> /cfcopy/.tmp/status
echo "--------- log ----------" >> /cfcopy/.tmp/status
#Updating log
imgnum=`ls -R /cfcopy/images/$imgdir | grep -c jpg`
movnum=`ls -R /cfcopy/images/$imgdir | grep -c avi`
echo `/bin/date "+%d %b %H:%M"` > /cfcopy/.tmp/log.new
echo " copied $imgnum img & $movnum mov" >> /cfcopy/.tmp/log.new
cat /cfcopy/.tmp/log.new /cfcopy/.tmp/log.old > /cfcopy/.tmp/log
cp --force /cfcopy/.tmp/log /cfcopy/.tmp/log.old
#Writing new status file
cat /cfcopy/.tmp/status /cfcopy/.tmp/log > /cfcopy/statuslog
# Cleaning up
umount /dev/hdc1
/bin/rom
/bin/ro
else
echo "Copying failed..."
fi
My next plan is to borrow some of the source code from the excellent viewer application, and make use of its capability of hacking into the Hijack menu.
This way I could do a lot of extra things in the code, for instance do a verification of the copying, launch the copy process itself from within the menu instead of running it at boot time and many other things...
And by the way - I got my new Kingston 256 Mb CF card yesterday - and it is working perfect!
At boot time it reports itself as a "TOSHIBA THNCF256MBA, ATA DISK drive".
Regards
Nicolai