init III
This commit is contained in:
BIN
Windows WakeOnLAN/WOL/WOL.exe
Normal file
BIN
Windows WakeOnLAN/WOL/WOL.exe
Normal file
Binary file not shown.
32
Windows WakeOnLAN/WOL/WOL.perlsvc
Normal file
32
Windows WakeOnLAN/WOL/WOL.perlsvc
Normal file
@@ -0,0 +1,32 @@
|
||||
#!C:\Program Files\ActiveState Perl Dev Kit 8.2.1\bin\perlsvc-gui.exe
|
||||
PAP-Version: 1.0
|
||||
Packer: C:\Program Files\ActiveState Perl Dev Kit 8.2.1\bin\perlsvc.exe
|
||||
Script: WOL.pl
|
||||
Cwd: G:\My Documents\Diverse Skripts\WOL
|
||||
Clean: 1
|
||||
Date: 2011-03-21 16:04:20
|
||||
Debug:
|
||||
Dependent: 0
|
||||
Dyndll: 0
|
||||
Exe: WOL.exe
|
||||
Force: 1
|
||||
Hostname: neticfsys03
|
||||
Manifest:
|
||||
No-Compress: 0
|
||||
No-Logo: 0
|
||||
Runlib:
|
||||
Shared: none
|
||||
Tmpdir:
|
||||
Verbose: 0
|
||||
Version-Comments:
|
||||
Version-CompanyName:
|
||||
Version-FileDescription: WakeOnLan Client
|
||||
Version-FileVersion: 1
|
||||
Version-InternalName: WOLawClient
|
||||
Version-LegalCopyright:
|
||||
Version-LegalTrademarks:
|
||||
Version-OriginalFilename: WOLawClient
|
||||
Version-ProductName: WOLawClient
|
||||
Version-ProductVersion: 1
|
||||
Warnings: 0
|
||||
Xclude: 0
|
||||
130
Windows WakeOnLAN/WOL/WOL.pl
Normal file
130
Windows WakeOnLAN/WOL/WOL.pl
Normal file
@@ -0,0 +1,130 @@
|
||||
#!perl -w
|
||||
|
||||
package PerlSvc;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Net::Wake;
|
||||
|
||||
my $service = 'WOLawClient';
|
||||
my $servno = 0;
|
||||
my $logfile = 'c:/wol.log';
|
||||
my $configfile = 'c:/wol.conf';
|
||||
my $delay = 30;
|
||||
|
||||
my @options = ('log=s' => \$logfile,
|
||||
'config=s' => \$configfile,
|
||||
'service=s' => \$servno,
|
||||
);
|
||||
|
||||
# turn on autoflush
|
||||
$|=1;
|
||||
|
||||
(my $progname = $0) =~ s/.*?([^\\]+?)(\.\w+)$/$1/;
|
||||
our(%Config,$Verbose);
|
||||
|
||||
sub get_options {
|
||||
require Getopt::Long;
|
||||
my @options = @_;
|
||||
my $usage = pop @options;
|
||||
$SIG{__WARN__} = sub { print "$usage\n$_[0]"; exit 1 };
|
||||
Getopt::Long::GetOptions(@options);
|
||||
$SIG{__WARN__} = 'DEFAULT';
|
||||
}
|
||||
sub configure {
|
||||
%Config = (ServiceName => "WOLawClient$servno",
|
||||
DisplayName => "WOLawClient$servno",
|
||||
Parameters => "--log $logfile --config $configfile --service $servno",
|
||||
Description => "WakeOnLan Client");
|
||||
}
|
||||
sub Startup {
|
||||
get_options(@options, <<__USAGE__);
|
||||
Try `$progname --help` to get a list of valid options.
|
||||
__USAGE__
|
||||
|
||||
Log("\n$Config{DisplayName} starting at: ".localtime);
|
||||
my ($FILE)=@ARGV;
|
||||
open FH, "<$configfile";
|
||||
my @CONF=<FH>;
|
||||
close FH;
|
||||
while (ContinueRun($delay)) {
|
||||
foreach my $line (@CONF) {
|
||||
chomp;
|
||||
next if ($line =~ /^#/);
|
||||
my ($IP,$MAC,$PORT)=split / /,$line;
|
||||
Net::Wake::by_udp($IP,$MAC,$PORT);
|
||||
}
|
||||
}
|
||||
Log("$Config{DisplayName} stopped at: ".localtime);
|
||||
}
|
||||
sub Log {
|
||||
my $msg = shift;
|
||||
open(my $f, ">>$logfile") or die $!;
|
||||
print $f "$msg\n";
|
||||
close $f;
|
||||
}
|
||||
sub Install {
|
||||
#get_options('name=s' => \$service, @options, <<__USAGE__);
|
||||
get_options(@options, <<__INSTALL__);
|
||||
Valid --install suboptions are:
|
||||
|
||||
auto automatically start service
|
||||
--log log file name [$logfile]
|
||||
--config config file name [$configfile]
|
||||
--service service number [$servno]
|
||||
|
||||
For example:
|
||||
|
||||
$progname --install auto --log logfile --config configfile --service servicenumber
|
||||
|
||||
__INSTALL__
|
||||
|
||||
configure();
|
||||
}
|
||||
sub Help {
|
||||
print <<__HELP__;
|
||||
|
||||
Sends WakeOnLan Packets to MAC addresses defined in configfile
|
||||
|
||||
Install it as a service:
|
||||
|
||||
$progname --install auto --log logfile --config configfile --service servicenumber
|
||||
net start $service
|
||||
|
||||
You can pause and resume the service with:
|
||||
|
||||
net pause $service
|
||||
net continue $service
|
||||
|
||||
To remove the service from your system, stop und uninstall it:
|
||||
|
||||
net stop $service
|
||||
$progname --remove
|
||||
|
||||
servicenumber defaults to 0
|
||||
logfile defaults to c:\\wol.log
|
||||
configfile defaults to c:\\wol.conf
|
||||
__HELP__
|
||||
|
||||
# Don't display standard PerlSvc help text
|
||||
$Verbose = 0;
|
||||
}
|
||||
sub Pause {
|
||||
Log("$Config{ServiceName} is about to pause at ".localtime);
|
||||
}
|
||||
sub Continue {
|
||||
Log("$Config{ServiceName} is continuing at ".localtime);
|
||||
}
|
||||
sub Remove {
|
||||
get_options('service=s' => \$servno, <<__REMOVE__);
|
||||
Valid --remove suboptions are:
|
||||
|
||||
--service service number [$servno]
|
||||
|
||||
For example:
|
||||
|
||||
$progname --remove --service 0
|
||||
__REMOVE__
|
||||
$Config{ServiceName} = "$service$servno";
|
||||
$Config{DisplayName} = "$service$servno";
|
||||
}
|
||||
32
Windows WakeOnLAN/WOL/WOL2.perlsvc
Normal file
32
Windows WakeOnLAN/WOL/WOL2.perlsvc
Normal file
@@ -0,0 +1,32 @@
|
||||
#!C:\Program Files\ActiveState Perl Dev Kit 8.2.1\bin\perlsvc-gui.exe
|
||||
PAP-Version: 1.0
|
||||
Packer: C:\Program Files\ActiveState Perl Dev Kit 8.2.1\bin\perlsvc.exe
|
||||
Script: WOL.pl
|
||||
Cwd: G:\My Documents\Diverse Skripts\WOL
|
||||
Clean: 0
|
||||
Date: 2011-03-21 18:21:51
|
||||
Debug:
|
||||
Dependent: 0
|
||||
Dyndll: 0
|
||||
Exe: WOL.exe
|
||||
Force: 0
|
||||
Hostname: neticfsys03
|
||||
Manifest:
|
||||
No-Compress: 0
|
||||
No-Logo: 0
|
||||
Runlib:
|
||||
Shared: none
|
||||
Tmpdir:
|
||||
Verbose: 0
|
||||
Version-Comments:
|
||||
Version-CompanyName:
|
||||
Version-FileDescription:
|
||||
Version-FileVersion: 2
|
||||
Version-InternalName: WOLawClient
|
||||
Version-LegalCopyright:
|
||||
Version-LegalTrademarks:
|
||||
Version-OriginalFilename: WOLawClient
|
||||
Version-ProductName: WOLawClient
|
||||
Version-ProductVersion: 2
|
||||
Warnings: 0
|
||||
Xclude: 0
|
||||
2
Windows WakeOnLAN/WOL/wol0.conf
Normal file
2
Windows WakeOnLAN/WOL/wol0.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
#ip mac port
|
||||
255.255.255.255 00:24:a5:00:ec:17 9
|
||||
12
Windows WakeOnLAN/WOL/wol0.log
Normal file
12
Windows WakeOnLAN/WOL/wol0.log
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
WOLawClient2 starting at: Mon Mar 21 17:48:31 2011
|
||||
WOLawClient2 stopped at: Mon Mar 21 17:51:36 2011
|
||||
|
||||
WOLawClient0 starting at: Thu Nov 10 10:18:49 2011
|
||||
WOLawClient0 stopped at: Thu Nov 10 10:19:11 2011
|
||||
|
||||
WOLawClient0 starting at: Thu Nov 10 10:19:16 2011
|
||||
WOLawClient0 stopped at: Thu Nov 10 10:41:26 2011
|
||||
|
||||
WOLawClient0 starting at: Thu Nov 10 10:47:53 2011
|
||||
WOLawClient0 stopped at: Thu Nov 10 10:48:13 2011
|
||||
Reference in New Issue
Block a user