I am using the rsyncbackup script of the German magazine c't for all my backup needs (Link). First, I had the script in my autostart folder which worked ok; but it just made too many backups, because I had a new version whenever I logged off and on again. I tried to use the Windows task scheduler to make one backup per week but got an error message I did not understand. Also, some other programs downloaded from the web did not do what I wanted (eg. they did not perform a backup when I did not log on the configured day of the week but waited for the next week).
So I programmed my own small script.
The script executeInterval is programmed with Microsoft Powershell. It reads the name of the program to execute and an interval (in days) from a configuration file (executeInterval.cfg). It executes the program when the last time it was run is equal or more than the configured number of days ago. The date of last execution is written to a run file (executeInterval.run). All actions are written to a log file (executeInterval.log).
The format of the configuration file is easy: First line is the program to execute, second line is the number of days. A sample file is included. The interval 0 is used because it is best for testing purposes. Change it as soon as you have your setup running.
My autostart entry looks as follows:
The script requires a working Powershell installation. I am using it with Powershell 2.0 and Windows Vista SP2 but I am sure that it runs with other Powershell and Windows versions.
This is my first Powershell script. It has a number of limitations:
Help me! I would be very thankful if you provided any help on improving the code and/or overcome the limitations; new ideas are of course welcome as well. Feedback including code snippets are preferred of course.
| Bernd Schandl (schandl at gmx dot com) | Back home |