Hinzugefügt:

* Wake-On-Lan
  * Connection-Scheduler


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@211 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2006-07-17 18:18:39 +00:00
parent 52345790a3
commit 4e5653511d
17 changed files with 1302 additions and 34 deletions

View File

@@ -0,0 +1,77 @@
#!/usr/bin/perl
#
# Library file for Connection Scheduler AddOn
#
# This code is distributed under the terms of the GPL
#
package CONNSCHED;
$CONNSCHED::maxprofiles = 5;
@CONNSCHED::weekdays = ( 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' );
@CONNSCHED::weekdays_pr = ( 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday' );
%CONNSCHED::config;
$CONNSCHED::configfile = "/var/ipfire/connscheduler/connscheduler.conf";
&ReadConfig;
1;
#
# load the configuration file
#
sub ReadConfig
{
# datafileformat:
# active,action,profilenr,time,daystype,days,weekdays,,comment
@CONNSCHED::config = ();
my @tmpfile = ();
if ( open(FILE, "$configfile") )
{
@tmpfile = <FILE>;
close (FILE);
}
foreach $line ( @tmpfile )
{
chomp($line); # remove newline
my @temp = split(/\,/,$line,9);
if ( ($temp[0] ne 'on') && ($temp[0] ne 'off') ) { next; }
my $weekdays_pr = '';
for (my $i = 0; $i < 7; $i++)
{
if ( index($temp[6], $CONNSCHED::weekdays[$i]) != -1 )
{
$weekdays_pr .= "$Lang::tr{$CONNSCHED::weekdays_pr[$i]} ";
}
}
push @CONNSCHED::config, { ACTIVE => $temp[0], ACTION => $temp[1], PROFILENR => $temp[2], TIME => $temp[3],
DAYSTYPE => $temp[4], DAYS => $temp[5], WEEKDAYS => $temp[6], WEEKDAYS_PR => $weekdays_pr, COMMENT => $temp[8] };
}
}
#
# write the configuration file
#
sub WriteConfig
{
open(FILE, ">$configfile") or die 'hosts datafile error';
for my $i ( 0 .. $#CONNSCHED::config )
{
if ( ($CONNSCHED::config[$i]{'ACTIVE'} ne 'on') && ($CONNSCHED::config[$i]{'ACTIVE'} ne 'off') ) { next; }
print FILE "$CONNSCHED::config[$i]{'ACTIVE'},$CONNSCHED::config[$i]{'ACTION'},$CONNSCHED::config[$i]{'PROFILENR'},";
print FILE "$CONNSCHED::config[$i]{'TIME'},$CONNSCHED::config[$i]{'DAYSTYPE'},";
print FILE "$CONNSCHED::config[$i]{'DAYS'},$CONNSCHED::config[$i]{'WEEKDAYS'},,$CONNSCHED::config[$i]{'COMMENT'}\n";
}
close FILE;
&ReadConfig();
}

View File

@@ -1,24 +0,0 @@
sub genmenu
{
... snip ...
if ( ! -e "${General::swroot}/proxy/enable" && ! -e "${General::swroot}/proxy/enable_blue" ) {
splice (@{$menu{'2.status'}{'subMenu'}}, 4, 1);
splice (@{$menu{'7.mainlogs'}{'subMenu'}}, 2, 1);
}
# Read additionnal menus entry
# this have to be hardened and accepted. To be extended.
opendir (DIR, "${General::swroot}/addon-menu");
while (my $menuitem = readdir (DIR)) {
if ( $menuitem =~ /^menu\.([1-6]\..*)\..*/) { #model is "menu.(N.submenu).filename"
my $submenu = $1;
open (FILE,"${General::swroot}/addon-menu/$menuitem") or die;
while (my $text = <FILE>) { # file may content many entry
splice (@{$menu{$submenu}{'subMenu'}} ,-1,0, [ eval($text) ] );
}
close (FILE);
}
}
closedir (DIR);
}

View File

@@ -268,6 +268,12 @@ sub genmenu {
'title' => "$tr{'aliases'}",
'enabled' => 0,
};
$subnetwork->{'80.wakeonlan'} = {
'caption' => $tr{'WakeOnLan'},
'uri' => '/cgi-bin/wakeonlan.cgi',
'title' => "$tr{'WakeOnLan'}",
'enabled' => 1,
};
my %subserviceshash = ();
my $subservices = \%subserviceshash;
@@ -463,7 +469,7 @@ sub genmenu {
if (! blue_used()) {
$menu->{'05.firewall'}{'subMenu'}->{'30.wireless'}{'enabled'} = 0;
}
if (! $ethsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $ethsettings{'RED_TYPE'} eq 'STATIC' ) {
if ( $ethsettings{'CONFIG_TYPE'} =~ /^(2|3|6|7)$/ && $ethsettings{'RED_TYPE'} eq 'STATIC' ) {
$menu->{'03.network'}{'subMenu'}->{'70.aliases'}{'enabled'} = 1;
}
}

View File

@@ -1,5 +1,5 @@
#
# $Id: crontab,v 1.9.2.5 2005/08/16 05:39:23 gespinasse Exp $
# crontab for ipfire
#
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
@@ -33,9 +33,12 @@ HOME=/
find /var/log/logwatch/ -ctime +${LOGWATCH_KEEP=56} -exec rm -f '{}' ';'
# hddshutdown
00 * * * * /usr/local/bin/hddshutdown >/dev/null
02 * * * * /usr/local/bin/hddshutdown >/dev/null
# URL Filter
%nightly * 3-5 /var/ipfire/urlfilter/autoupdate/cron.daily
%weekly * 3-5 /var/ipfire/urlfilter/autoupdate/cron.weekly
%monthly * 3-5 * /var/ipfire/urlfilter/autoupdate/cron.monthly
# connection-scheduler
*/5 * * * * /usr/local/bin/connscheduler timer > /dev/null