libreschool-client-manager/root/etc/e-smith/events/actions/client-wake-all

22 lines
467 B
Perl
Executable File

#!/usr/bin/perl -w
package esmith;
use strict;
use Errno;
use esmith::DB::db;
use IO::File;
use English;
my $db_hosts = esmith::DB::db->open('hosts') || die("Could not open e-smith db (" . esmith::DB::db->error . ")\n");
my @items = $db_hosts->get_all('local');
foreach my $item (@items) {
my $hostName = $item->key;
my $mac = $item->prop('MacAddress');
system("/sbin/ether-wake -b -i lan0 $mac &") == 0
or die "Error waking up $hostName";
}
exit 0;