A GemStone/S 64 Bit system needs to have various maintenance tasks performed regularly. One of these is managing log file, backups, and transaction logs. I recently put together a basic Linux VM that has GemStone/S 64 Bit installed, but little more (the last link here). One of the non-Smalltalk things that I sometimes struggle with is figuring out which file can be deleted. The following demonstrates some bash scripting that seems to address a few of my questions. It starts by deleting all but the most recent two log files for pcmon, pagemanager, and symbolgem. It then does some garbage collection activity and a full backup. It then deletes all but the most recent two backups. Finally, if there are two backups in the last two days, it deletes all transaction logs more than two days old. This does not do as much error checking as should be done in a serious production environment (such as try restoring the backup, apply transaction logs, etc., before deleting things), but it demonstrates some of the things that can be done in bash to do date-specific cleanup.
#!/bin/bash # cleanup log files cd /opt/gemstone/log (ls -t *pcmon.log | head -n 2; ls *pcmon.log) | \ sort | uniq -u | xargs rm (ls -t *pagemanager.log | head -n 2; ls *pagemanager.log) | \ sort | uniq -u | xargs rm (ls -t *symbolgem.log | head -n 2; ls *symbolgem.log) | \ sort | uniq -u | xargs rm # do backup topaz -l -T 50000 << EOF output push backup.out errorCount send SystemRepository markForCollection send SystemRepository reclaimAll send SystemRepository startNewLog run SystemRepository fullBackupCompressedTo: '/opt/gemstone/backups/backup-' , (DateTime now asSeconds // 60) printString. % logout errorCount exit EOF # cleanup backups cd /opt/gemstone/backups (ls -t backup* | head -n 2; ls backup*) | sort | uniq -u | xargs rm if [ "2" -le "`find . -mtime -2 -name 'backup*' | wc -l`" ]; then cd /opt/gemstone/data find . -mtime +2 -name 'tranlog*' | xargs rm fi
6 comments
Comments feed for this article
March 4, 2013 at 11:56 pm
tobiaspape
This is great 🙂
Does the full backup guarantee that the old logs can be removed?
I have figured out that `copydbf` can tell you which is the last transaction log necessary for the stone. Would that fit into the script?
March 5, 2013 at 9:05 am
James Foster
Hi Tobias,
This approach only deletes transaction logs that are older than the latest saved backup, so we don’t need to explicitly ask the backup which logs are required. Because of the reliance on two backups in the last two days, and deleting transaction logs older than two days, we could easily have more than the required transaction logs, but we should not ever have less than required (and the old logs will eventually be deleted).
The copydbf would still be useful to verify that the backup is valid, and that could be added to the script.
James
March 7, 2013 at 1:45 am
tobiaspape
Hi James
Thank you for that insight.
March 12, 2013 at 7:18 pm
Van von Vandelay
What, pray tell, would be the Ubuntu username & password to login into the VMWare image in http://seaside.gemstone.com/jade/GemStoneApp.dmg ? (Thanks for your blog, btw; I’ve found it very helpful!)
March 12, 2013 at 8:07 pm
James Foster
The VMware appliance at http://seaside.gemstone.com/jade/glass.zip has GemStone/S 64 Bit 3.1.0.2 running in Linux 12.04 LTE. The user is ‘glass’ and the password is ‘glass’ (I think). It has scripts to start and stop with the OS, perform regular backups, MFC, etc. I seem to recall a recent build in which ‘glass’ was not acceptable (not enough characters or cannot be the same as the user?), so I used ‘swordfish’; if one doesn’t work try the other. (I’ll confirm this when I get back to the office.)
The link you provided is actually for a Macintosh application.
March 12, 2013 at 9:58 pm
Van von Vandelay
Indeed, wrong link. Thanks, glass/glass worked.