How do I only run a task on one startup a day?
January 25, 2008 7:48 AM Subscribe
I need to schedule a task to run only on the first startup of each day.
Hi all, I'm running Windows XP and open source, light-weight solutions are preferred.
Thanks!
Hi all, I'm running Windows XP and open source, light-weight solutions are preferred.
Thanks!
Hi,
Since no one else has responded to this question yet, I'll outline how I would do this.
1. Install cygwin ( open source unix emulation layer for windows).
2. Write a shell script that runs your task.]
3. Modify your shell script so that it only performs your task the first time it is run on a given day. One way to do this would be to create a file with a name associated with the day the first time it is run and not do anything if that file already exists.
4. Use cygrunsrv ( a cygwin utility ) to run your script as a service each time windows boots.
There are probably easier solutions but this should work. I have been a little sketchy on details. If you would like this solution and want more details let me know and I can supply them.
- Dave
posted by metadave at 9:47 AM on January 25, 2008
Since no one else has responded to this question yet, I'll outline how I would do this.
1. Install cygwin ( open source unix emulation layer for windows).
2. Write a shell script that runs your task.]
3. Modify your shell script so that it only performs your task the first time it is run on a given day. One way to do this would be to create a file with a name associated with the day the first time it is run and not do anything if that file already exists.
4. Use cygrunsrv ( a cygwin utility ) to run your script as a service each time windows boots.
There are probably easier solutions but this should work. I have been a little sketchy on details. If you would like this solution and want more details let me know and I can supply them.
- Dave
posted by metadave at 9:47 AM on January 25, 2008
Schedule a task using the built in task scheduler. There is an option for daily. Schedule its time to be 00:01 (12:01 am). The first time you boot us that day, it will fire off.
posted by gjc at 9:56 AM on January 25, 2008
posted by gjc at 9:56 AM on January 25, 2008
Start > Settings > Control Panel > Scheduled Tasks > Add Scheduled Task
posted by -harlequin- at 10:14 AM on January 25, 2008
posted by -harlequin- at 10:14 AM on January 25, 2008
Response by poster: @ gjc
I'm surprised....this will really work? Ok, I'll try it. I'm drunk right now so forgive my incredulity
posted by edbyford at 5:48 PM on January 25, 2008
I'm surprised....this will really work? Ok, I'll try it. I'm drunk right now so forgive my incredulity
posted by edbyford at 5:48 PM on January 25, 2008
This thread is closed to new comments.
if that doesn't meet your requirements, you're going to want to script a solution, basically, create a lock file with the current day's date. if you start up a second time that day, the system checks for the lock file, if it's there, the script will stop. if it find no lock file, or yesterday's lock file, it will (delete yesterday's and) create a new lock file and complete your task.
If you were running a unix variant, I could give you pretty quick shell example. Someone else will need to do a batch, VB or WSH version for you.
posted by jrishel at 9:37 AM on January 25, 2008