Preventing backup on shutdownForum: Other Help Topics Topic: Preventing backup on shutdown started by: colinbes Posted by colinbes on Oct. 19 2006,23:24
Am using DSL with frugal install on compact flash with restore option enabled. After updating to new package (I was way, way behind) I noticed that on shutdown the backup script is run. In my application it is important that the backup script is not automatically executed, especially on shutdown.Any suggestions on how to prevent this (obviously restore must happen automatically on startup). Thanks, Colin Posted by andrewb on Oct. 20 2006,00:12
Simplest way is to pull the plug rather than executing the shutdown script. Might need to make sure you sync any drives first though to avoid any data loss due to buffering.If you want to disable backup delete the file .backup_device in /opt. This will prevent a backup ocurring. However it won't stop a restore being done at the next boot if an earlier backup.tar.gz file exists on one of the filesystems found during booting. You either need to delete all such files, or boot with the norestore option. Posted by roberts on Oct. 20 2006,01:27
backup and restore go hand in hand. If you have specified a restore boot time option then that becomes the target backup device.The backup device can be easily cleared using the Backup/Restore Button from control panel, then select the None button. However, from your requirements,i.e,, wanting a restore but no further backup. implies that your backup.tar.gz is static. That is the very definition of our extension type tar.gz. So I would suggest renaming your backup.tar.gz to something like myconf.tar.gz and then use the standard mydsl options to load it. This will prevent you from having to clear the backup device upon each boot. Note: Depending on what other extensions might be loaded, you may wish to rename your backup.tar.gz to something that would ensure it will be loaded/restored last. Doing so will better emulate the natural order of restoration where the backup files are restored after all other mydsl extensions. Posted by colinbes on Oct. 20 2006,02:07
Pulling the plug would not be an option in an unattended site and in any case we monitor ups and do a safe shutdown in event of power failure. Unfortunately remove .backup file in /opt would most probably stop restore from working.I did think about using extension mechanism but decided to go backup/restore route (which on version 0.9.3 didn't do backup on shutdown) as we do have occasion, when system is updated or reconfigured, to execute new backup. This has provided a safe environment with a rollback feature (simply reboot to restore last env) allowing user to test application changes before commiting changes via backup. I suppose I could remove the .backup and create it when running backup... Posted by andrewb on Oct. 20 2006,04:07
Removing .backup_device wouldn't affect the restore function as all that does is look for the first instance of backup.tar.gz that it finds on the filesystems. Roberts suggestion of seleting 'none' in the backup tool of DSL panel should achieve the same result.The issue with restoring looking for ANY backup.tar.gz is that if you have used one device (say /dev/hda1) & you then change to using a different one (e.g. /dev/hda3) the old backup.tar.gz on hda1 will always be used by restore as it will be found first when the filesystems are searched as it has a lower number (1 vs 3). Similarly if you change from using e.g. /dev/hda3 to using /dev/hda1 & then decide to cancel using the backup AND delete the backup.tar.gz file on hda1, the old backup.tar.gz on hda3 will be found at the next reboot & the settings in that will be reloaded. I have had problems with the backup system using the runlevel 2 boot option. It appears not to restore, but it does a backup, thus resetting everything to the default values. There probably does need to be some tweaking of the backup restore system to remove anomalies such as this, & possibly give the option of deleting/renaming the backup file when 'none' is selected in the backup tool. Posted by mikshaw on Oct. 20 2006,04:44
If it doesn't backup from runlevel 2, my only guess is that you are not shutting down properly. The system must enter either runlevel 0 or 6 and run knoppix-reboot or knoppix-halt in order for the backup to occur. It looks to me as though the backup system is properly coded to work as expected regardless of your runlevel.
Posted by roberts on Oct. 20 2006,18:46
If do have backup.tar.gz sitting on multiple devices, which you shouldn't, you always have complete control of your system by specifying which device by using the restore boot option.In fact all auto searches can be overridden with boot options. Be it restore, mydsl, or even bootfrom. By specifying the exact device will speed up the boot process, as auto scanning will not be performed. On the otherhand the auto scan feature provides a nice and easy hands free boot from CD experience. Posted by andrewb on Oct. 22 2006,23:44
I've realised what the problem was I was having - I had a persistent /opt directory. In this case .backup_device exists permanently so even when 'norestore' is specified a backup still occurs on shutdown. I'm moving away from the persistent /opt so the problem should go away. When there is a persistent /opt it's not that it doesn't backup - it DOES backup from runlevel 2, but no RESTORE is done when 'DSL 2' is used as a boot option. This results in the previous backup being overwritten with default values. I've tracked this down to the 'DSL 2' boot line in grub having the 'norestore' option specified. This means that if you decide to boot to CLI using 'DSL 2' you will not have your backup restored, BUT you will have you backup overwritten when you close down (unless you just pull the plug!). To my mind this is a trap for the unwary. Particularly with slower systems where you may use a persistent /opt & want to boot to CLI rather than X on every occasion. I suggest the 'norestore' option be removed from the 'DSL 2' boot option for the default install. Users can always add 'norestore' if they wish & at least they will then be aware of what is going on. If I get a chance I'll check how the WIKI describes the backup/restore function, but it does need to be made clear that specifying 'norestore' at boot time doesn't stop a backup being made of the settings from that session being done Posted by colinbes on Oct. 23 2006,00:13
Found an easy solution to preventing auto restore on shutdown while still maintaining ease of backup. In /opt there is a script called powerdown.sh, removing appropriate lines prevent backup from being called. I went this route and kept /opt/.backup_device as this allowed presetting of backup device and provision of simple script for support personnel to remotely execute backup when required. Just make sure that powerdown.sh is included in filetool.lst file else the change won't be restored on next reboot. |