I joined DH to find a semi-permanent home for my genealogy research. As part of that, I use a program called GED2HTML which will generate HTML files from a GEDCOM file (a standard genealogical data format). There is a Linux ELF version available which I have downloaded and successfully run from within a DH SSH session.
That being said, I’d like to setup a cron job that can automatically rebuild my pages anytime I upload a new GEDCOM file. The biggest problem seems to be that GED2HTML creates lowercase links within a given document’s HTML file, but the files themselves are created with uppercase names… I’ve cobbled together the following shell script which I think should work as follows:
- Go to the directory where I would upload a new GEDCOM
- If there is no GEDCOM there with the correct name do nothing; otherwise
- Go to the destination directory for the new files and copy everything there to a backup directory
- Go back to the GEDCOM directory and run GED2HTML, sending the output to the destination directory
- Rename all files in the destination directory to lowercase
- Delete the GEDCOM file used to create the HTML files
Here’s the script:
for GEDCOM in .
if [ “$GEDCOM” = “$myGED” ]
for FILES in .
mv -f $FILES "$gedhome/backup"
./ged2html -f options.g2h -D DESTINATION_DIRECTORY="$destdir" $myGED
for FILES in .
DEST=$(echo $FILES | tr A-Z a-z)
if [ “$DEST” != “$FILES” ]
mv -f “$FILES” "$DEST"
[/code]Any “gotchas” that would prevent this from working as a cron job? Any suggestions for optimizations (I’m sure there’s some)?