You are here

backup on regular intervals

2 posts / 0 new
Last post
janvg
Offline
Last seen: 12 years 5 months ago
Joined: 2011-12-15 11:12
backup on regular intervals

Is it possible to let Toucan do a backup on regular intervals (every 2 minutes for instance). The problem i want to solve is the following:
I have a directory in which files are temporarily (very short time sometimes) stored, before the are moved away by a program. I want to keep a copy of these files.
I think the best way to do this is to let a backup program run in the background and backup the directory every couple of minutes (before the files are moved).
Can Toucan do this?
Thanks
JanVG

Steve Lamerton
Steve Lamerton's picture
Offline
Last seen: 10 years 7 months ago
Developer
Joined: 2005-12-10 15:22
You

could do this with Toucan no problem at all, you would need some code like the following, to be run in the script and with a backup job called "BackupJob".

function sleep(n)
  if n > 0 then os.execute("ping -n " .. tonumber(n+1) .. " localhost > NUL") end
end

while true do
	backup("BackupJob")
	sleep(120)
end

The main problem is that it loops forever with no way of killing it short of task manager, but I will add a new function before the release of 3.1 to allow it to shut down gracefully when the cancel button is clicked.

Log in or register to post comments