Zeitanzeige fuer PPP-Verbindungen...

Samba-User hinzugefuegt.


git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@492 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-04-11 23:04:45 +00:00
parent 1cdddb1205
commit f3bbb213fa
8 changed files with 219 additions and 5 deletions

View File

@@ -17,6 +17,7 @@ utmp:x:22:
squid:x:23:
ntp:x:38:
dip:x:40:
mysql:x:41:
rsyncd:x:48:
stunnel:x:51:
lock:x:54:
@@ -35,4 +36,4 @@ postdrop:x:108:
clamav:x:109:
amavis:x:110:
mldonkey:x:111:
mysql:x:41:
samba:x:1000:

View File

@@ -4,19 +4,20 @@ daemon:x:2:2:daemon:/sbin:/bin/false
mail:x:8:12:mail:/var/spool/mail:/bin/false
squid:x:23:23:ftp:/var/spool/squid:/bin/false
ntp:x:38:38::/etc/ntp:/bin/false
mysql:x:41:41:MySQL Server:/dev/null:/bin/false
rsyncd:x:48:48:rsyncd Daemon:/home/rsync:/bin/false
sshd:x:74:74:sshd:/var/empty:/bin/false
nobody:x:99:99:Nobody:/home/nobody:/bin/false
postfix:x:100:100::/var/spool/postfix:/bin/false
snort:x:101:101:ftp:/var/log/snort:/bin/false
logwatch:x:102:102::/var/log/logwatch:/bin/false
dnsmasq:x:103:103::/:/bin/false
cron:x:104:104::/:/bin/false
syslogd:x:105:105:/var/empty:/bin/false
klogd:x:106:106:/var/empty:/bin/false
postfix:x:100:100::/var/spool/postfix:/bin/false
clamav:x:109:109:Clam AntiVirus:/home/clamav:/bin/false
rsyncd:x:48:48:rsyncd Daemon:/home/rsync:/bin/false
amavis:x:110:110:Amavisd-new user:/var/amavis:
cyrus:x:111:12:Cyrus user:/usr/cyrus:
filter:x:112:12:Spam user:/home/filter:/bin/false
mldonkey:x:113:111:Mldonkey user:/opt/mldonkey:/bin/false
mysql:x:41:41:MySQL Server:/dev/null:/bin/false
samba:x:1000:1000:Samba User:/var/empty:/bin/false

View File

@@ -52,6 +52,7 @@ tmp
usr/lib/libgcc_s.so
usr/lib/libgcc_s.so.1
usr/local/bin/connscheduler
usr/local/bin/dialctrl.pl
usr/local/bin/hddshutdown
usr/local/bin/hddshutdown-state
usr/local/bin/httpscert
@@ -117,6 +118,7 @@ var/empty
var/lock
#var/log
var/log/btmp
var/log/counter
var/log/lastlog
var/log/wtmp
var/mail

View File

@@ -104,6 +104,9 @@ print <<END;
<tr> <td bgcolor='$Header::colourred' width='25%'><a href="/cgi-bin/pppsetup.cgi"><font size='2' color='white'><b>$Lang::tr{'internet'}:</b></font></a><br>
<td width='30%'>$ipaddr
<td width='45%'>$connstate
END
print `/usr/local/bin/dialctrl.pl show`;
print <<END;
<tr><td colspan='2'>
<form method='post' action='/cgi-bin/dial.cgi'>$Lang::tr{'profile'}:
<select name='PROFILE'>
@@ -282,7 +285,9 @@ if ($warnmessage) {
}
print <<END;
</table>
END
&Header::closebox();
&Header::closebigbox();

View File

@@ -301,6 +301,7 @@
'archive not exist' => 'Konfigurationsarchiv existiert nicht',
'are you sure' => 'Sind Sie sicher?',
'arp table entries' => 'Einträge der ARP-Tabelle:',
'attemps' => 'Versuche',
'august' => 'August',
'authentication' => 'Authentifizierung:',
'automatic' => 'Automatisch',
@@ -517,6 +518,7 @@
'directory mask' => 'UNIX Verzeichnis Rechte',
'directory writeable' => 'Verzeichnis schreibbar',
'disconnect' => 'OVPN Stop / Trennen',
'disconnects' => 'Abbrüche',
'disk access per' => 'Plattenzugriff je',
'disk usage' => 'Festplattenbelegung:',
'display' => 'Anzeige',
@@ -1216,6 +1218,7 @@
'shutdown2' => 'Herunterfahren:',
'shutting down' => 'Fahre herunter',
'shutting down ipfire' => 'Fahre IPFire herunter',
'since' => 'seit',
'sitekey' => 'Sitekey',
'sitekeyfile' => 'Sitekeyfile',
'size' => 'Größe',

View File

@@ -304,6 +304,7 @@
'archive not exist' => 'Configuration archive does not exist',
'are you sure' => 'Are you sure?',
'arp table entries' => 'ARP Table Entries:',
'attemps' => 'Attempts',
'august' => 'August',
'authentication' => 'Authentication:',
'automatic' => 'Automatic',
@@ -531,6 +532,7 @@
'directory mask' => 'UNIX directory rights',
'directory writeable' => 'directory writeable',
'disconnect' => 'OVPN Stop / Disconnect',
'disconnects' => 'Disconnects',
'disk access per' => 'Disk Access per',
'disk usage' => 'Disk usage:',
'display' => 'Display',
@@ -1229,6 +1231,7 @@
'shutdown2' => 'Shutdown:',
'shutting down' => 'Shutting down',
'shutting down ipfire' => 'Shutting down IPFire',
'since' => 'since',
'sitekey' => 'Sitekey',
'sitekeyfile' => 'Sitekeyfile',
'size' => 'Size',

View File

@@ -98,7 +98,7 @@ $(TARGET) :
# Create /var dirs and files
-mkdir -v /var/{lock,log,mail,run,spool,empty}
-mkdir -pv /var/{opt,cache,lib/{misc,locate},local}
touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
touch /var/run/utmp /var/log/{btmp,lastlog,wtmp,counter}
chgrp -v utmp /var/run/utmp /var/log/lastlog
chmod -v 664 /var/run/utmp /var/log/lastlog

199
src/scripts/dialctrl.pl Normal file
View File

@@ -0,0 +1,199 @@
#!/usr/bin/perl
#
# Dialup Statistics for IPFire
# based on SilverStar's work on
# http://goodymuc.go.funpic.de
#
require '/var/ipfire/general-functions.pl';
require "${General::swroot}/lang.pl";
require "${General::swroot}/header.pl";
($sec,$min,$hour,$mday,$mon,$year,$wday,$ydat,$isdst)=localtime();
$jahr=$year;
$monat=$mon+1;
$tag=$mday;
$jahr=$year;
$jahr=$year +1900;
if (length($monat) == 1)
{
$monat="0$monat";
}
if(length($tag) == 1)
{
$tag="0$tag";
}
if(length($hour) == 1)
{
$hour="0$hour";
}
if(length($min) == 1)
{
$min="0$min";
}
if(length($sec) == 1)
{
$sec="0$sec";
}
my $s_date = $tag."/".$monat."/".$jahr;
my $s_time = $hour.":".$min.":".$sec;
my $file_log = "/var/log/counter/dialup.log";
my $file_connect = "/var/log/counter/connect";
my $file_reset = "/var/log/counter/reset";
if ($ARGV[0] eq 'up') {
if (! -e "$file_log") {
&new;
} else {
open(CONNECT,">$file_connect");
close(CONNECT);
open(COUNTER,"<$file_log");
$line = <COUNTER>;
($start,$update,$up,$down,$rec,$on,$bit) = split(/\|/,$line);
close(COUNTER);
$up++;
$update = $s_date." on ".$s_time;
open(COUNTER,">$file_log");
print COUNTER "$start\|$update\|$up\|$down\|$rec\|$on\|$bit";
close(COUNTER);
}
}
if ($ARGV[0] eq 'down') {
if (! -e "$file_log") {
&new;
} else {
open(COUNTER,"<$file_log");
$line = <COUNTER>;
($start,$update,$up,$down,$rec,$on,$bit) = split(/\|/,$line);
close(COUNTER);
$on =~ /(\d+)d\s+(\d+)h\s+(\d+)m\s+(\d+)s/;
$d1 = $1; $h1 = $2; $m1 = $3; $s1 = $4;
$con = &General::age("$file_connect");
$con =~ /(\d+)d\s+(\d+)h\s+(\d+)m\s+(\d+)s/;
$d2 = $1; $h2 = $2; $m2 = $3; $s2 = $4;
$sum_d = ($d1 + $d2) * 86400;
$sum_h = ($h1 + $h2) * 3600;
$sum_m = ($m1 + $m2) * 60;
$sum_s = ($s1 + $s2);
$sum_1 = $sum_d + $sum_h + $sum_m + $sum_s;
$d = int($sum_1 / 86400);
$totalhours = int($sum_1 / 3600);
$h = $totalhours % 24;
$totalmins = int($sum_1 / 60);
$m = $totalmins % 60;
$s = $sum_1 % 60;
$on = "${d}d ${h}h ${m}m ${s}s";
$down++;
$update = $s_date." on ".$s_time;
open(COUNTER,">$file_log");
print COUNTER "$start\|$update\|$up\|$down\|$rec\|$on\|$bit";
close(COUNTER);
}
}
if ($ARGV[0] eq 'rec') {
if (! -e "$file_log") {
&new;
} else {
open(COUNTER,"<$file_log");
$line = <COUNTER>;
($start,$update,$up,$down,$rec,$on,$bit) = split(/\|/,$line);
close(COUNTER);
$rec++;
$update = $s_date." on ".$s_time;
open(COUNTER,">$file_log");
print COUNTER "$start\|$update\|$up\|$down\|$rec\|$on\|$bit";
close(COUNTER);
}
}
elsif ($ARGV[0] eq 'show') {
if (! -e "$file_log") {
&new;
}
else {
open(COUNTER,"<$file_log");
$line = <COUNTER>;
($start,$update,$up,$down,$rec,$on,$bit) = split(/\|/,$line);
$on =~ /(\d+)d\s+(\d+)h\s+(\d+)m\s+(\d+)s/;
$d1 = $1; $h1 = $2; $m1 = $3; $s1 = $4;
close(COUNTER);
if ( ! -e "${General::swroot}/red/active") {
$timecon = "0d 0h 0m 0s";
} else {
$timecon = &General::age("$file_connect");
}
$timecon =~ /(\d+)d\s+(\d+)h\s+(\d+)m\s+(\d+)s/;
$d2 = $1; $h2 = $2; $m2 = $3; $s2 = $4;
$timeres = &General::age("$file_reset");
$timeres =~ /(\d+)d\s+(\d+)h\s+(\d+)m\s+(\d+)s/;
$d3 = $1; $h3 = $2; $m3 = $3; $s3 = $4;
$sum_d1 = ($d1 + $d2) * 86400;
$sum_h1 = ($h1 + $h2) * 3600;
$sum_m1 = ($m1 + $m2) * 60;
$sum_s1 = ($s1 + $s2);
$sum_1 = $sum_d1 + $sum_h1 + $sum_m1 + $sum_s1;
$sum_d2 = $d3 * 86400;
$sum_h2 = $h3 * 3600;
$sum_m2 = $m3 * 60;
$sum_s2 = $s3;
$sum_2 = $sum_d2 + $sum_h2 + $sum_m2 + $sum_s2;
$d = int($sum_1 / 86400);
$totalhours = int($sum_1 / 3600);
$h = $totalhours % 24;
$totalmins = int($sum_1 / 60);
$m = $totalmins % 60;
$s = $sum_1 % 60;
$current = "${d}d ${h}h ${m}m ${s}s";
$ontime = ( $sum_1 * 100 ) / $sum_2;
if ($ontime >= 99.95) {
$ontime = sprintf("%.0f", $ontime);
}
elsif ($ontime <= 0.05) {
$ontime = sprintf("%.0f", $ontime);
}
else {
$ontime = sprintf("%.1f", $ontime);
}
print <<END
<br />$Lang::tr{'since'} $start
<tr><td colspan='3' align='center'>$Lang::tr{'connections'}: $up | $Lang::tr{'disconnects'}: $down | $Lang::tr{'attemps'}: $rec
<tr><td><b>Verbindungszeit:</b><td align='right'>$current<td align='left'> ~ $ontime%
END
;
}
}
elsif ($ARGV[0] eq 'reset') {
&new;
}
elsif ($ARGV[0] eq '') {
print "\nDont run on the console...\n\n";
}
exit 0;
sub new {
open(COUNTER,">$file_log");
$start = $s_date." on ".$s_time;
$update = "&#8249;no action since clearing&#8250;";
$up = "0";
$down = "0";
$rec = "0";
$on = "0d 0h 0m";
$bit = "0";
print COUNTER "$start\|$update\|$up\|$down\|$rec\|$on\|$bit";
close(COUNTER);
open(CONNECT,">$file_connect");
print CONNECT "0";
close(CONNECT);
open(RESET,">$file_reset");
print RESET "0";
close(RESET);
}