Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Re: Win32 Task Scheduler Monitor

by Courage (Parson)
on Jun 04, 2002 at 16:42 UTC ( #171549=note: print w/ replies, xml ) Need Help??


in reply to Re: Win32 Task Scheduler Monitor
in thread Win32 Task Scheduler Monitor

well, my luck here is probably better that yours, because your latest unmodified script works with some non-zero results, after I added a task. Look:

D:\>at 20:20 /interactive /every:5 calc Added a new job with job ID = 2 D:\Personal\perl\admin\tst>perl -w am.pl ==>0 ==>1/8 Job 2 is calc
1/8 is hash in scalar context, you ignore "8" and see that you have one single key in that hash.

Slightly reorganize code and see that we've got what we searched for:

use strict; use Win32::AdminMisc; my $server="\\\\serverserversevverv"; my %JobInfo; my $Day; my @DOM; my %Jobs; my $Number; Win32::AdminMisc::ScheduleList($server, \%Jobs); print "==>".%Jobs."\n"; foreach $Number (keys(%Jobs)){ print "Job $Number is $Jobs{$Number}->{Command}\n"; if (Win32::AdminMisc::ScheduleGet($server, $Number, \%JobInfo)){ foreach $Day (1..31){ push(@DOM, $Day) if ($JobInfo{DOM} & 2**$Day); } print "This job will run on the following days of the month:\n +"; print join(", ", @DOM); } }
the output is not that bad in my case:
D:\Personal\perl\admin\tst>perl -w am.pl ==>2/8 Job 2 is calc This job will run on the following days of the month: 4Job 3 is calc This job will run on the following days of the month: 4, 18

let me know if you need more details.

Courage, the Cowardly Dog.
PS. Something fishy is going on there, or my name is Vadim Konovalov. And it's not.


Comment on Re: Re: Win32 Task Scheduler Monitor
Select or Download Code
Re: Win32 Task Scheduler Monitor
by LovelyGreeting (Novice) on Jun 05, 2002 at 15:06 UTC
    Yes, Courage. You make it so clear. I can get the same result as yours, and I also know the difference between us. I did the schedule through Task Scheduler (Setting->Control Pannel->Scheduled Tasks, which Win2000 called Task Scheduler). Task scheduler has more control but can't be checked by AdminMisc::ScheduleGet. I have to set user account for scheduled task, but AT command doesn't support account setting. Any idea or suggestion?
      Yes, there *IS* a way! See Re: Win32 Task Scheduler Monitor. (to avoid deep re:re:re...)

      I am proud of finding such short yet capable way of doing things on Win32. :)

      Courage, the Cowardly Dog.
      PS. Something fishy is going on there, or my name is Vadim Konovalov. And it's not.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://171549]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-09-22 21:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (202 votes), past polls