Modified the crash backup script to add options "disable" and "resume".
However, this has not been implemented as it has been observed that the use of itimer() has a restriction of one timer per process, which interferes with the three or more uses of the timer within magic. The timer method will have to be changed to use the POSIX timer_create() routine, before this will work properly.
This commit is contained in:
parent
59bfa6ce86
commit
8a0b180cde
|
|
@ -58,11 +58,31 @@ proc magic::makecrashbackup {} {
|
|||
global Opts
|
||||
|
||||
*bypass crash save
|
||||
if {$Opts(backupinterval) > 0} {
|
||||
after $Opts(backupinterval) magic::makecrashbackup
|
||||
if {![catch set Opts(backupinterval)]} {
|
||||
if {$Opts(backupinterval) > 0} {
|
||||
after $Opts(backupinterval) magic::makecrashbackup
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------
|
||||
# magic::crashbackups ---
|
||||
#
|
||||
# Create periodic backups. Options are:
|
||||
#
|
||||
# start: Begin periodic backups. If interval is not
|
||||
# specified, then set interval to 10 minutes.
|
||||
#
|
||||
# resume: Resume periodic backups if started and stopped,
|
||||
# but not if disabled or never started.
|
||||
#
|
||||
# stop: Stop periodic backups.
|
||||
#
|
||||
# disable: Disable periodic backups; set to state of
|
||||
# never having been started.
|
||||
#
|
||||
#----------------------------------------------------------------
|
||||
|
||||
proc magic::crashbackups {{option start}} {
|
||||
global Opts
|
||||
|
||||
|
|
@ -71,12 +91,25 @@ proc magic::crashbackups {{option start}} {
|
|||
if {[catch set Opts(backupinterval)]} {
|
||||
set Opts(backupinterval) 600000
|
||||
}
|
||||
after $Opts(backupinterval) magic::makecrashbackup
|
||||
if {$Opts(backupinterval) > 0} {
|
||||
after $Opts(backupinterval) magic::makecrashbackup
|
||||
}
|
||||
}
|
||||
resume {
|
||||
if {![catch set Opts(backupinterval)]} {
|
||||
if {$Opts(backupinterval) > 0} {
|
||||
after $Opts(backupinterval) magic::makecrashbackup
|
||||
}
|
||||
}
|
||||
}
|
||||
stop -
|
||||
cancel {
|
||||
after cancel magic::makecrashbackup
|
||||
}
|
||||
disable {
|
||||
after cancel magic::makecrashbackup
|
||||
unset Opts(backupinterval)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,8 +26,17 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
#include <signal.h>
|
||||
#include <unistd.h> /* for getpid() */
|
||||
#include <sys/time.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "tcltk/tclmagic.h"
|
||||
#include "utils/main.h"
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "utils/signals.h"
|
||||
#include "windows/windows.h"
|
||||
#include "graphics/graphics.h"
|
||||
|
||||
#ifndef SIGEMT
|
||||
#define SIGEMT 7 /* EMT instruction (SIGUNUSED) */
|
||||
|
|
@ -57,17 +66,6 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "utils/magic.h"
|
||||
#include "utils/magsgtty.h"
|
||||
#include "textio/textio.h"
|
||||
#include "utils/geometry.h"
|
||||
#include "utils/signals.h"
|
||||
#include "windows/windows.h"
|
||||
#include "graphics/graphics.h"
|
||||
|
||||
|
||||
#ifndef FASYNC
|
||||
# define FASYNC 00100 /* kludge for SUN2s */
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue