Saving persistence (db4o) at shutdown

Is there a way to configure OpenHab to save all item values on shutdown so that restoreOnStartup has some values to work with?

Not really. Most people use an every change or a frequent polling period so changes get persisted quickly enough to avoid stale or unrefined items on startup. If this isn’t happening for you there might be something else wrong. One thing to note is rrd4j only saves numbers so if you need to restore strings you will need to use an alternative.

I was using every change, but my DB grew way to fast because of all the frequent JSON blobs from a lot of my items. So now I have:

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies {
	everyHour 	: "0 0 * * * ?"
	everyNight 	: "55 59 23 * * ?"

	// if no strategy is specified for an item entry below, the default list will be used
	default = everyChange
}

/* 
 * Each line in this section defines for which item(s) which strategy(ies) should be applied.
 * You can list single items, use "*" for all items or "groupitem*" for all members of a group
 * item (excl. the group item itself).
 */
Items {
* : strategy = everyNight, restoreOnStartup
	Light*, Outlet*, Door*, Entry*, Window*, Propane*, Generator*, Solar*, Water* : strategy = everyChange, restoreOnStartup
	Temperature*, Weather* Totals* : strategy = everyChange, everyHour, restoreOnStartup
}

Should I see db4o reads at startup in the log file? I am set to DEBUG and just see writes in my db4o.log file.

Is db4o your default persistence? I think it only restores from persitence on startup from your default.

Changed, no difference, only writes in the db4o.log file.

2015-11-30 13:24:51 DEBUG o.o.p.d.internal.Db4oActivator[:24]- db4o persistence bundle has been started.
2015-11-30 13:24:51 DEBUG o.o.p.d.i.Db4oPersistenceService[:218]- Scheduled Commit-Job with interval 5sec.
2015-11-30 13:24:52 DEBUG o.o.p.d.i.Db4oPersistenceService[:231]- Scheduled Backup-Job with cron expression '0 0 1 * * ?'
2015-11-30 13:24:53 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Shop_Tstat_Temperature' -> '56.5'
2015-11-30 13:24:53 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Electric_Room_Tstat_Temperature' -> '68.0'
2015-11-30 13:24:53 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Well_Level' -> '226.7'
2015-11-30 13:24:54 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Septic_Level' -> '21.6'
2015-11-30 13:24:54 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Water_Quality_C' -> '17'
2015-11-30 13:24:54 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Water_Quality_A' -> '23'
2015-11-30 13:24:54 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Water_Quality_In' -> '366'
2015-11-30 13:24:54 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Hot_Water_Temp' -> '81.374'
2015-11-30 13:24:56 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Weather_Pressure' -> '30.33'
2015-11-30 13:24:56 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Wind_Speed' -> '0.87'
2015-11-30 13:24:56 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Weather_Temp_Min' -> 'Undefined'
2015-11-30 13:24:56 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Wind_Degree' -> '30.00'
2015-11-30 13:24:56 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Wind_Direction' -> 'NNE'
2015-11-30 13:24:56 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Weather_Temp_Max' -> 'Undefined'
2015-11-30 13:24:59 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Weather_Temp_Max' -> '38.84'
2015-11-30 13:24:59 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Weather_Temp_Min' -> '34.88'
2015-11-30 13:25:41 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Battery_Charge' -> '80'
2015-11-30 13:25:41 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Battery_Voltage' -> '47.4'
2015-11-30 13:25:41 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Solar_Charge_A_Watts' -> '137.46'
2015-11-30 13:25:41 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Solar_Charge_B_Watts' -> '137.46'
2015-11-30 13:25:41 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Solar_Charge_C_Watts' -> '132.72'
2015-11-30 13:25:41 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Solar_Charge_D_Watts' -> '99.54'
2015-11-30 13:25:41 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Office_Tstat_Temperature' -> '68.5'
2015-11-30 13:25:41 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Water_Room_Tstat_Temperature' -> '68.5'
2015-11-30 13:25:41 DEBUG o.o.p.d.i.Db4oPersistenceService[:118]- Stored item state 'Solar_Total_Watts' -> '507.18'

I don’t know if it logs when it reads, or it is possible something in openhab core logs when it reads. You have confirmed that the states are not being restored or just checking the logs?