The stupid question is the question not asked | |
PerlMonks |
Re: starting a win2000-service with delayby inman (Curate) |
on Sep 19, 2003 at 12:14 UTC ( [id://292643]=note: print w/replies, xml ) | Need Help?? |
Write a perl script that when run (on start up) uses the windows scheduler to create a scheduled job to start the service two hours later. The job will run once and then be removed from the scheduled list. The user that the service runs as is configured in the services control panel.
The following example starts the service 'myService' after 7200 seconds (two hours).
#! /usr/bin/perl -w use strict; use warnings; my $command = "net start myService"; my $delay = 7200; my $startTime = time + $delay; my ($seconds, $minutes, $hours, $day) = localtime $startTime; `at $hours:$minutes /next:$day $command`; inman
In Section
Seekers of Perl Wisdom
|
|