[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ipcop-cvs
Subject:    [IPCop-cvs] ipcop/html/cgi-bin time.cgi,1.4.2.12,1.4.2.13
From:       Achim Weber <dotzball () users ! sourceforge ! net>
Date:       2007-03-22 10:37:27
Message-ID: E1HUKg9-0001l0-RL () mail ! sourceforge ! net
[Download RAW message or body]

Update of /cvsroot/ipcop/ipcop/html/cgi-bin
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv32130/html/cgi-bin

Modified Files:
      Tag: IPCOP_v1_4_0
	time.cgi 
Log Message:
Move periodically written timeserver files to /var/log/time. 
This is another backport from cvs HEAD (but a bit improved, own dir /var/log/time \
where all periodically written files are located now).

Improve CF support (==less writes to CF card)


Index: time.cgi
===================================================================
RCS file: /cvsroot/ipcop/ipcop/html/cgi-bin/time.cgi,v
retrieving revision 1.4.2.12
retrieving revision 1.4.2.13
diff -C2 -d -r1.4.2.12 -r1.4.2.13
*** time.cgi	23 Jul 2006 21:49:22 -0000	1.4.2.12
--- time.cgi	22 Mar 2007 10:37:22 -0000	1.4.2.13
***************
*** 4,8 ****
  #
  # This file is part of the IPCop Project
! # 
  # This code is distributed under the terms of the GPL
  #
--- 4,8 ----
  #
  # This file is part of the IPCop Project
! #
  # This code is distributed under the terms of the GPL
  #
***************
*** 74,78 ****
  		$timesettings{'VALID'} = 'no'; }
  	else {
!        	$timesettings{'VALID'} = 'yes'; }
  
  	if ($timesettings{'VALID'} eq 'yes') {
--- 74,78 ----
  		$timesettings{'VALID'} = 'no'; }
  	else {
! 		$timesettings{'VALID'} = 'yes'; }
  
  	if ($timesettings{'VALID'} eq 'yes') {
***************
*** 91,95 ****
  
  if ($timesettings{'ACTION'} eq $Lang::tr{'save'})
! { 
  	if ($timesettings{'ENABLENTP'} eq 'on')
  	{
--- 91,95 ----
  
  if ($timesettings{'ACTION'} eq $Lang::tr{'save'})
! {
  	if ($timesettings{'ENABLENTP'} eq 'on')
  	{
***************
*** 138,167 ****
  		$timesettings{'VALID'} = 'yes'; }
  
! 		&General::writehash("${General::swroot}/time/settings", \%timesettings);
! 		open(FILE, ">/${General::swroot}/time/settime.conf") or die "Unable to write \
                settime.conf file";
! 		flock(FILE, 2);
! 		print FILE "$timesettings{'NTP_ADDR_1'} $timesettings{'NTP_ADDR_2'}\n";
! 		close FILE;
  
! 		my $updateperiod=0;
  
! 		if  ($timesettings{'UPDATE_PERIOD'} eq 'daily') {
! 			$updateperiod = $timesettings{'UPDATE_VALUE'} * 1440; }
! 		elsif  ($timesettings{'UPDATE_PERIOD'} eq 'weekly') {
! 			$updateperiod = $timesettings{'UPDATE_VALUE'} * 10080; }
! 		elsif  ($timesettings{'UPDATE_PERIOD'} eq 'monthly') {
! 			$updateperiod = $timesettings{'UPDATE_VALUE'} * 40320; }
! 		else {
! 			$updateperiod = $timesettings{'UPDATE_VALUE'} * 60; }
  
! 		$updateperiod = $updateperiod - 5;
  
! 		if ($updateperiod <= 5) {
! 			$updateperiod = 5; }
  
! 		open(FILE, ">/${General::swroot}/time/counter.conf") or die "Unable to write \
                counter.conf file";
! 		flock(FILE, 2);
! 		print FILE "$updateperiod\n";
! 		close FILE;
  
  	if ($timesettings{'ENABLENTP'} eq 'on' && $timesettings{'VALID'} eq 'yes')
--- 138,170 ----
  		$timesettings{'VALID'} = 'yes'; }
  
! 	&General::writehash("${General::swroot}/time/settings", \%timesettings);
! 	open(FILE, ">/${General::swroot}/time/settime.conf") or die "Unable to write \
                settime.conf file";
! 	flock(FILE, 2);
! 	print FILE "$timesettings{'NTP_ADDR_1'} $timesettings{'NTP_ADDR_2'}\n";
! 	close FILE;
  
! 	my $updateperiod=0;
  
! 	if  ($timesettings{'UPDATE_PERIOD'} eq 'daily') {
! 		$updateperiod = $timesettings{'UPDATE_VALUE'} * 1440; }
! 	elsif  ($timesettings{'UPDATE_PERIOD'} eq 'weekly') {
! 		$updateperiod = $timesettings{'UPDATE_VALUE'} * 10080; }
! 	elsif  ($timesettings{'UPDATE_PERIOD'} eq 'monthly') {
! 		$updateperiod = $timesettings{'UPDATE_VALUE'} * 40320; }
! 	else {
! 		$updateperiod = $timesettings{'UPDATE_VALUE'} * 60; }
  
! 	$updateperiod = $updateperiod - 5;
  
! 	if ($updateperiod <= 5) {
! 		$updateperiod = 5; }
  
! 	open(FILE, ">/${General::swroot}/time/counter.conf") or die "Unable to write \
                counter.conf file";
! 	flock(FILE, 2);
! 	print FILE "$updateperiod\n";
! 	close FILE;
! 
! 	# remove counter and settimenow-flag
! 	system ('/usr/local/bin/settimenow clean');
  
  	if ($timesettings{'ENABLENTP'} eq 'on' && $timesettings{'VALID'} eq 'yes')
***************
*** 169,179 ****
  		system ('/bin/touch', "${General::swroot}/time/enable");
  		&General::log($Lang::tr{'ntp syncro enabled'});
! 		unlink "${General::swroot}/time/counter";
  		if ($timesettings{'UPDATE_METHOD'} eq 'periodically')
  		{
! 			open(FILE, ">/${General::swroot}/time/counter") or die "Unable to write counter \
                file";
! 			flock(FILE, 2);
! 			print FILE "$updateperiod\n";
! 			close FILE;
  		}
  		if ($timesettings{'ENABLECLNTP'} eq 'on') # DPC added to 1.3.1
--- 172,179 ----
  		system ('/bin/touch', "${General::swroot}/time/enable");
  		&General::log($Lang::tr{'ntp syncro enabled'});
! 
  		if ($timesettings{'UPDATE_METHOD'} eq 'periodically')
  		{
! 			system ('/usr/local/bin/settimenow init');
  		}
  		if ($timesettings{'ENABLECLNTP'} eq 'on') # DPC added to 1.3.1
***************
*** 184,193 ****
  			unlink "${General::swroot}/time/allowclients";
  		}
- 	
  	}
  	else
  	{
  		unlink "${General::swroot}/time/enable";
- 		unlink "${General::swroot}/time/settimenow";
  		unlink "${General::swroot}/time/allowclients"; # DPC added to 1.3.1
  		&General::log($Lang::tr{'ntp syncro disabled'})
--- 184,191 ----
***************
*** 203,207 ****
  if ($timesettings{'ACTION'} eq $Lang::tr{'set time now'} && \
$timesettings{'ENABLENTP'} eq 'on')  {
! 	system ('/bin/touch', "${General::swroot}/time/settimenow");
  }
  
--- 201,205 ----
  if ($timesettings{'ACTION'} eq $Lang::tr{'set time now'} && \
$timesettings{'ENABLENTP'} eq 'on')  {
! 	system ('/usr/local/bin/settimenow');
  }
  
***************
*** 210,214 ****
  if ($timesettings{'VALID'} eq '')
  {
!  	$timesettings{'ENABLENTP'} = 'off';
  	$timesettings{'UPDATE_METHOD'} = 'manually';
  	$timesettings{'UPDATE_VALUE'} = '1';
--- 208,212 ----
  if ($timesettings{'VALID'} eq '')
  {
! 	$timesettings{'ENABLENTP'} = 'off';
  	$timesettings{'UPDATE_METHOD'} = 'manually';
  	$timesettings{'UPDATE_VALUE'} = '1';
***************
*** 245,251 ****
  $selected{'UPDATE_PERIOD'}{$timesettings{'UPDATE_PERIOD'}} = "selected='selected'";
  
! # added to v0.0.4 to refresh screen if syncro event queued 
  my $refresh = '';
! if ( -e "${General::swroot}/time/settimenow") {
  	$refresh = "<meta http-equiv='refresh' content='60;' />";
  }
--- 243,249 ----
  $selected{'UPDATE_PERIOD'}{$timesettings{'UPDATE_PERIOD'}} = "selected='selected'";
  
! # added to v0.0.4 to refresh screen if syncro event queued
  my $refresh = '';
! if ( -e "/var/log/time/settimenow") {
  	$refresh = "<meta http-equiv='refresh' content='60;' />";
  }
***************
*** 277,284 ****
  ;
  
! if ( -e "${General::swroot}/time/lastset")
  {
  	print "$Lang::tr{'clock last synchronized at'}\n";
! 	my $output = `/bin/cat ${General::swroot}/time/lastset`;
  	print $output;
  }
--- 275,282 ----
  ;
  
! if ( -e "/var/log/time/lastset")
  {
  	print "$Lang::tr{'clock last synchronized at'}\n";
! 	my $output = `/bin/cat /var/log/time/lastset`;
  	print $output;
  }
***************
*** 329,333 ****
  ;
  
! if ( -e "${General::swroot}/time/settimenow") {
  	print "<tr>\n<td align='center'><img src='/images/clock.gif' alt='' /></td>\n";
  	print "<td colspan='2'><font color='red'>$Lang::tr{'waiting to synchronize \
                clock'}...</font></td></tr>\n";
--- 327,331 ----
  ;
  
! if ( -e "/var/log/time/settimenow") {
  	print "<tr>\n<td align='center'><img src='/images/clock.gif' alt='' /></td>\n";
  	print "<td colspan='2'><font color='red'>$Lang::tr{'waiting to synchronize \
                clock'}...</font></td></tr>\n";
***************
*** 358,362 ****
  <tr>
  	<td width='65%' class='base'>
! 	<table>	
  	<tr>
  		<td>$Lang::tr{'year'}:&nbsp;</td>
--- 356,360 ----
  <tr>
  	<td width='65%' class='base'>
! 	<table>
  	<tr>
  		<td>$Lang::tr{'year'}:&nbsp;</td>
***************
*** 370,374 ****
  		<td>&nbsp;$Lang::tr{'minutes'}:&nbsp;</td>
  		<td><input type='text' name='SETMINUTES' size='2' maxlength='2' \
                value='$timesettings{'SETMINUTES'}' /></td>
! 	</tr>	
  	</table>
  	</td>
--- 368,372 ----
  		<td>&nbsp;$Lang::tr{'minutes'}:&nbsp;</td>
  		<td><input type='text' name='SETMINUTES' size='2' maxlength='2' \
                value='$timesettings{'SETMINUTES'}' /></td>
! 	</tr>
  	</table>
  	</td>


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
IPCop-cvs mailing list
IPCop-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-cvs


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic