Skip to content

Commit 988e005

Browse files
authored
Merge pull request #1528 from bergware/master
Nchan processes: only publish on changes
2 parents 8ef4614 + 6919d12 commit 988e005

17 files changed

Lines changed: 189 additions & 108 deletions

emhttp/plugins/dynamix/ArrayOperation.page

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,16 @@ function formatWarning(val) {
389389
});
390390
}
391391
}
392+
393+
window.onunload = function(){
394+
<?if (_var($var,'fsState')=='Started'):?>
395+
mymonitor.stop();
396+
devices.stop();
397+
<?endif;?>
398+
<?if ($spot==0):?>
399+
paritymonitor.stop();
400+
<?endif;?>
401+
}
392402
</script>
393403
<form name="arrayOps" method="POST" action="/update.htm" target="progressFrame">
394404
<input type="hidden" name="startState" value="<?=htmlspecialchars(_var($var,'mdState'))?>">

emhttp/plugins/dynamix/DashStats.page

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,11 @@ foreach ($cpus as $pair) {
264264
<a href='/Dashboard/Tools/Processes' title="_(View Running Processes)_"><i class='fa fa-fw fa-info-circle control'></i></a>
265265
</td></tr>
266266
<tr><td><span class='w36'><i class='ups fa fa-compress'></i>_(Usable size)_: <?=my_scale($total,$unit,1,null,1024)." $unit"?></span><i class='ups fa fa-expand'></i>_(Maximum size)_: <?="$memory_maximum $unit"?><?=$low?'*':''?></td></tr>
267-
<tr id='var0'><td><span class='w26'><i class='ups fa fa-fw fa-microchip'></i>_(RAM)_</span><span class='w72'><span class='sys0 load resize'>0%</span><div class='usage-disk sys'><span id='sys0'></span><span></span></div></span></td></tr>
268-
<tr id='var1'><td><span class='w26'><i class='ups fa fa-fw fa-shield'></i>_(ZFS)_</span><span class='w72'><span class='sys1 load resize'>0%</span><div class='usage-disk sys'><span id='sys1'></span><span></span></div></span></td></tr>
269-
<tr id='var2'><td><span class='w26'><i class='ups fa fa-fw fa-pencil-square'></i>_(Flash)_</span><span class='w72'><span class='sys2 load resize'>0%</span><div class='usage-disk sys'><span id='sys2'></span><span></span></div></span></td></tr>
270-
<tr id='var3'><td><span class='w26'><i class='ups fa fa-fw fa-file-text'></i>_(Log)_</span><span class='w72'><span class='sys3 load resize'>0%</span><div class='usage-disk sys'><span id='sys3'></span><span></span></div></span></td></tr>
271-
<tr id='var4'><td><span class='w26'><i class='ups fa fa-fw fa-docker'></i>_(Docker)_</span><span class='w72'><span class='sys4 load resize'>0%</span><div class='usage-disk sys'><span id='sys4'></span><span></span></div></span></td></tr>
267+
<tr id='var0'><td><span class='w26'><i class='ups fa fa-fw fa-microchip'></i>_(RAM)_</span><span class='w72'><span class='sys0 load resize'>0%</span><span class="sys0_ load resize"></span><div class='usage-disk sys'><span id='sys0'></span><span></span></div></span></td></tr>
268+
<tr id='var1'><td><span class='w26'><i class='ups fa fa-fw fa-shield'></i>_(ZFS)_</span><span class='w72'><span class='sys1 load resize'>0%</span><span class="sys1_ load resize"></span><div class='usage-disk sys'><span id='sys1'></span><span></span></div></span></td></tr>
269+
<tr id='var2'><td><span class='w26'><i class='ups fa fa-fw fa-pencil-square'></i>_(Flash)_</span><span class='w72'><span class='sys2 load resize'>0%</span><span class="sys2_ load resize"></span><div class='usage-disk sys'><span id='sys2'></span><span></span></div></span></td></tr>
270+
<tr id='var3'><td><span class='w26'><i class='ups fa fa-fw fa-file-text'></i>_(Log)_</span><span class='w72'><span class='sys3 load resize'>0%</span><span class="sys3_ load resize"></span><div class='usage-disk sys'><span id='sys3'></span><span></span></div></span></td></tr>
271+
<tr id='var4'><td><span class='w26'><i class='ups fa fa-fw fa-docker'></i>_(Docker)_</span><span class='w72'><span class='sys4 load resize'>0%</span><span class="sys4_ load resize"></span><div class='usage-disk sys'><span id='sys4'></span><span></span></div></span></td></tr>
272272
</tbody>
273273

274274
<tbody title="_(Interface Information)_" class="mixed">
@@ -390,8 +390,7 @@ echo "</td></tr>";
390390

391391
<div class='tile' id='tile2'>
392392
<table id='db-box2' class='share_status dashboard'>
393-
<?if ($display['dashapps']!='none'):?>
394-
<?if ($dockerd && ($display['dashapps']=='icons' || $display['dashapps']=='docker')):?>
393+
<?if ($dockerd):?>
395394
<tbody id='docker_view' title="_(Docker Containers)_" data="noApps()">
396395
<tr><td><i class='icon-docker f32'></i><div class='section'>_(Docker Containers)_<br>
397396
<span id="tile_apps"><span class='apps'><input type='checkbox' id='apps'></span></span>
@@ -400,7 +399,7 @@ echo "</td></tr>";
400399
</td></tr>
401400
</tbody>
402401
<?endif;?>
403-
<?if ($libvirtd && ($display['dashapps']=='icons' || $display['dashapps']=='vms')):?>
402+
<?if ($libvirtd):?>
404403
<tbody id='vm_view' title="_(Virtual Machines)_" data="noVMs()">
405404
<tr><td><i class='icon-virtualization f32'></i><div class='section'>_(Virtual Machines)_<br>
406405
<span id="tile_vms"><span class='vms'><input type='checkbox' id='vms'></span></span>
@@ -409,7 +408,6 @@ echo "</td></tr>";
409408
</td></tr>
410409
</tbody>
411410
<?endif;?>
412-
<?endif;?>
413411

414412
<tbody title="_(Shares Information)_"<?if ($group):?> class="mixed"<?endif;?>>
415413
<tr><td><i class='icon-folder f32'></i><div class='section'>_(Shares)_
@@ -909,7 +907,7 @@ function loadlist(init) {
909907
$('#vms').is(':checked') ? $.cookie('my_vms','startedOnly',{expires:3650}) : $.removeCookie('my_vms');
910908
});
911909
}
912-
$.post('/webGui/include/DashboardApps.php',{display:'<?=$display['dashapps']?>',docker:'<?=$dockerd?>',vms:'<?=$libvirtd?>'},function(d) {
910+
$.post('/webGui/include/DashboardApps.php',{docker:'<?=$dockerd?>',vms:'<?=$libvirtd?>'},function(d) {
913911
var data = d.split('\0');
914912
$('#docker_view tr.updated').remove();
915913
$('#docker_view').append(data[0]).hideMe();
@@ -1185,14 +1183,14 @@ function addProperties() {
11851183
$(this).find('td:first').prepend("<i class='fa fa-fw fa-close control tile' onclick='dismiss($(this))' title=\"_(Close Tile)_\"></i>");
11861184
});
11871185
$('div.frame tr').attr('title','');
1188-
$('tr#var0').hover(function(){if(!timers.var0){timers.var0=setTimeout(function(){timers.var0=null},3000);$.post('/webGui/include/DashboardApps.php',{sys:0},function(val){$('.sys0').not('.head').text(val);});}});
1186+
$('tr#var0').hover(function(){if(!timers.var0){timers.var0=setTimeout(function(){timers.var0=null;$('.sys0_').hide();$('.sys0').show();},5000);$.post('/webGui/include/DashboardApps.php',{sys:0},function(val){$('.sys0').hide();$('.sys0_').text(val).show();});}});
11891187
<?if ($zfs):?>
1190-
$('tr#var1').show().hover(function(){if(!timers.var1){timers.var1=setTimeout(function(){timers.var1=null},3000);$.post('/webGui/include/DashboardApps.php',{sys:1},function(val){$('.sys1').text(val);});}});
1188+
$('tr#var1').show().hover(function(){if(!timers.var1){timers.var1=setTimeout(function(){timers.var1=null;$('.sys1_').hide();$('.sys1').show();},5000);$.post('/webGui/include/DashboardApps.php',{sys:1},function(val){$('.sys1').hide();$('.sys1_').text(val).show();});}});
11911189
<?endif;?>
1192-
$('tr#var2').hover(function(){if(!timers.var2){timers.var2=setTimeout(function(){timers.var2=null},3000);$.post('/webGui/include/DashboardApps.php',{sys:2},function(val){$('.sys2').text(val);});}});
1193-
$('tr#var3').hover(function(){if(!timers.var3){timers.var3=setTimeout(function(){timers.var3=null},3000);$.post('/webGui/include/DashboardApps.php',{sys:3},function(val){$('.sys3').text(val);});}});
1190+
$('tr#var2').hover(function(){if(!timers.var2){timers.var2=setTimeout(function(){timers.var2=null;$('.sys2_').hide();$('.sys2').show();},5000);$.post('/webGui/include/DashboardApps.php',{sys:2},function(val){$('.sys2').hide();$('.sys2_').text(val).show();});}});
1191+
$('tr#var3').hover(function(){if(!timers.var3){timers.var3=setTimeout(function(){timers.var3=null;$('.sys3_').hide();$('.sys3').show();},5000);$.post('/webGui/include/DashboardApps.php',{sys:3},function(val){$('.sys3').hide();$('.sys3_').text(val).show();});}});
11941192
<?if ($dockerd):?>
1195-
$('tr#var4').show().hover(function(){if(!timers.var4){timers.var4=setTimeout(function(){timers.var4=null},3000);$.post('/webGui/include/DashboardApps.php',{sys:4},function(val){$('.sys4').text(val);});}});
1193+
$('tr#var4').show().hover(function(){if(!timers.var4){timers.var4=setTimeout(function(){timers.var4=null;$('.sys4_').hide();$('.sys4').show();},5000);$.post('/webGui/include/DashboardApps.php',{sys:4},function(val){$('.sys4').hide();$('.sys4_').text(val).show();});}});
11961194
<?endif;?>
11971195
}
11981196
function showContent() {
@@ -1628,4 +1626,11 @@ $(function() {
16281626
$.post('/webGui/include/InitCharts.php',{cmd:'set',data:JSON.stringify(data)});
16291627
});
16301628
});
1629+
1630+
window.onunload = function(){
1631+
dashboard.stop();
1632+
<?if ($apcupsd):?>
1633+
apcups.stop();
1634+
<?endif;?>
1635+
}
16311636
</script>

emhttp/plugins/dynamix/DisplaySettings.page

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -249,14 +249,6 @@ _(Temperature unit)_:
249249

250250
:display_temperature_unit_help:
251251

252-
_(Show Dashboard apps)_:
253-
: <select name="dashapps">
254-
<?=mk_option($display['dashapps'], "icons",_('Docker + VMs'))?>
255-
<?=mk_option($display['dashapps'], "docker",_('Docker only'))?>
256-
<?=mk_option($display['dashapps'], "vms",_('VMs only'))?>
257-
<?=mk_option($display['dashapps'], "none",_('None'))?>
258-
</select>
259-
260252
_(Dynamix color theme)_:
261253
: <select name="theme">
262254
<?foreach (glob("$docroot/webGui/styles/dynamix-*.css") as $themes):?>

emhttp/plugins/dynamix/include/Boot.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -110,43 +110,43 @@ function shutdown_now() {
110110
shutdown_online();
111111
}
112112
function reboot_online() {
113-
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:5000})
113+
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:500})
114114
.done(function(){
115115
$('.sub2').html("<?=_('System is going down')?>... "+timer());
116-
setTimeout(reboot_online,5000);
116+
setTimeout(reboot_online,500);
117117
})
118-
.fail(function(){start=new Date(); setTimeout(reboot_offline,5000);});
118+
.fail(function(){start=new Date(); setTimeout(reboot_offline,500);});
119119
}
120120
function reboot_offline() {
121-
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:5000})
121+
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:500})
122122
.done(function(){location = '/Main';})
123123
.fail(function(){
124124
$('.sub2').html("<?=_('System is rebooting')?>... "+timer());
125-
setTimeout(reboot_offline,1000);
125+
setTimeout(reboot_offline,500);
126126
});
127127
}
128128
function shutdown_online() {
129-
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:5000})
129+
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:500})
130130
.done(function(){
131131
$('.sub2').html("<?=_('System is going down')?>... "+timer());
132-
setTimeout(shutdown_online,5000);
132+
setTimeout(shutdown_online,500);
133133
})
134-
.fail(function(){start=new Date(); setTimeout(shutdown_offline,5000);});
134+
.fail(function(){start=new Date(); setTimeout(shutdown_offline,500);});
135135
}
136136
function shutdown_offline() {
137137
var time = timer();
138138
if (time < 30) {
139139
$('.sub2').html("<?=_('System is offline')?>... "+time);
140-
setTimeout(shutdown_offline,5000);
140+
setTimeout(shutdown_offline,500);
141141
} else {
142-
$('.sub2').html("<?=_('System is powered off')?>... "+time);
143-
setTimeout(power_on,1000);
142+
$('.sub2').html("<?=_('System is powered off')?>...");
143+
setTimeout(power_on,500);
144144
}
145145
}
146146
function power_on() {
147-
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:5000})
147+
$.ajax({url:'/webGui/include/ProcessStatus.php',type:'POST',data:{name:'emhttpd',update:true},timeout:500})
148148
.done(function(){location = '/Main';})
149-
.fail(function(){setTimeout(power_on,1000);});
149+
.fail(function(){setTimeout(power_on,500);});
150150
}
151151
$(document).ajaxSend(function(elm, xhr, s){
152152
if (s.type == 'POST') {

emhttp/plugins/dynamix/include/DashboardApps.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
die(my_scale($size,$unit,null,-1,1024)." $unit");
3535
}
3636

37-
$display = $_POST['display'];
38-
39-
if ($_POST['docker'] && ($display=='icons' || $display=='docker')) {
37+
if ($_POST['docker']) {
4038
$user_prefs = $dockerManPaths['user-prefs'];
4139
$DockerClient = new DockerClient();
4240
$DockerTemplates = new DockerTemplates();
@@ -78,7 +76,7 @@
7876
echo "</td></tr>";
7977
}
8078
echo "\0";
81-
if ($_POST['vms'] && ($display=='icons' || $display=='vms')) {
79+
if ($_POST['vms']) {
8280
$user_prefs = '/boot/config/plugins/dynamix.vm.manager/userprefs.cfg';
8381
$vms = $lv->get_domains() ?: [];
8482
if (file_exists($user_prefs)) {

emhttp/plugins/dynamix/include/Helpers.php

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -265,35 +265,36 @@ function delete_file(...$file) {
265265
array_map('unlink',array_filter($file,'file_exists'));
266266
}
267267
function getnvmepowerstate($device) {
268-
$array=[] ;
269-
exec("nvme id-ctrl $device |grep -E 'ps |wctemp|cctemp'",$array,$error) ;
270-
foreach ($array as $line){
271-
$split = explode(":",$line) ;
272-
$check=str_replace(" ","",trim($split[0]));
273-
switch($check){
274-
case "wctemp":
275-
$return['wctemp'] = $split[1] - 273;
276-
break;
277-
case "cctemp":
278-
$return['cctemp'] = $split[1] - 273;
279-
break;
280-
case "ps0":
281-
case "ps1":
282-
case "ps2":
283-
case "ps3":
284-
case "ps4":
285-
case "ps5":
286-
$power = explode(" ",$split[2]) ;
287-
$return[$check] = $power[0];
288-
break;
289-
}
268+
if (!exec("which nvme 2>/dev/null")) return; // temporary check
269+
exec("nvme id-ctrl $device | grep -E 'ps |wctemp|cctemp'",$rows);
270+
foreach ($rows as $row){
271+
if (!$row) continue;
272+
$split = explode(':',$row);
273+
$check = str_replace(' ','',trim($split[0]));
274+
switch ($check){
275+
case "wctemp":
276+
$return['wctemp'] = $split[1] - 273;
277+
break;
278+
case "cctemp":
279+
$return['cctemp'] = $split[1] - 273;
280+
break;
281+
case "ps0":
282+
case "ps1":
283+
case "ps2":
284+
case "ps3":
285+
case "ps4":
286+
case "ps5":
287+
$power = explode(' ',$split[2]);
288+
$return[$check] = $power[0];
289+
break;
290+
}
290291
}
291292
$powerstate = shell_exec("nvme get-feature $device -f 02");
292-
$powersplit = explode(":",$powerstate) ;
293-
$powerstate = substr(trim($powersplit[2]), -1) ;
294-
#get-feature:0x02 (Power Management), Current value:0x00000003)
295-
$return["powerstate"] = $powerstate;
296-
$return["powerstatevalue"] = $return['ps'.$return['powerstate']] ;
293+
$powersplit = explode(':',$powerstate);
294+
$powerstate = substr(trim($powersplit[2]),-1);
295+
# get-feature:0x02 (Power Management), Current value:0x00000003)
296+
$return['powerstate'] = $powerstate;
297+
$return['powerstatevalue'] = $return['ps'.$return['powerstate']];
297298
return $return;
298299
}
299300
?>

emhttp/plugins/dynamix/include/publish.php

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,30 @@
1111
*/
1212
?>
1313
<?
14+
function curl_socket($socket, $url, $message) {
15+
$com = curl_init($url);
16+
curl_setopt_array($com,[
17+
CURLOPT_UNIX_SOCKET_PATH => $socket,
18+
CURLOPT_POST => 1,
19+
CURLOPT_POSTFIELDS => $message,
20+
CURLOPT_RETURNTRANSFER => 1
21+
]);
22+
$reply = curl_exec($com);
23+
curl_close($com);
24+
return $reply;
25+
}
26+
1427
function publish($endpoint, $message, $len=1) {
1528
$com = curl_init("http://localhost/pub/$endpoint?buffer_length=$len");
16-
curl_setopt_array($com, [CURLOPT_UNIX_SOCKET_PATH => "/var/run/nginx.socket", CURLOPT_HTTPHEADER => ['Accept:text/json'], CURLOPT_RETURNTRANSFER => 1]);
29+
curl_setopt_array($com,[
30+
CURLOPT_UNIX_SOCKET_PATH => "/var/run/nginx.socket",
31+
CURLOPT_HTTPHEADER => ['Accept:text/json'],
32+
CURLOPT_POST => 1,
33+
CURLOPT_POSTFIELDS => $message,
34+
CURLOPT_RETURNTRANSFER => 1
35+
]);
1736
$reply = json_decode(curl_exec($com),true);
18-
// only send message when active subscribers are present
19-
if (($reply['subscribers']??0)>0) {
20-
curl_setopt_array($com, [CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $message]);
21-
$reply = json_decode(curl_exec($com),true);
22-
}
2337
curl_close($com);
24-
// return number of active subscribers
25-
return $reply['subscribers']??0;
38+
return $reply['subscribers'] ?? 0;
2639
}
2740
?>

emhttp/plugins/dynamix/nchan/device_list

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ $varroot = '/var/local/emhttp';
1717
$pool_log = '/var/tmp/pool_log.tmp';
1818
$smartALL = '/boot/config/smart-all.cfg';
1919
$smartONE = '/boot/config/smart-one.cfg';
20+
$md5_old = -1;
21+
$fs_old = -1;
2022

2123
require_once "$docroot/webGui/include/Helpers.php";
2224
require_once "$docroot/webGui/include/publish.php";
@@ -113,7 +115,12 @@ function device_desc(&$disk) {
113115
$log = _var($var,'fsState')=='Started'
114116
? "<a class='info hand' onclick=\"openTerminal('disklog','"._var($disk,'device')."','')\"><i class='icon-$type icon'></i><span>"._('Disk Log Information')."</span></a>"
115117
: "<a class='static'><i class='icon-$type icon'></i></a>";
116-
return $log."<span style='font-family:bitstream'>".my_id(_var($disk,'id'))."</span> - $size $unit ("._var($disk,'device').")";
118+
$powerstatevalue = "";
119+
if (_var($disk,'transport') == 'nvme') {
120+
$powerstate = getnvmepowerstate("/dev/"._var($disk,'device'));
121+
$powerstatevalue = is_array($powerstate) ? ' &bullet; '._('PS').': '._var($powerstate,'powerstatevalue','?').' '._var($powerstate,'powerstate','?') : '';
122+
}
123+
return $log."<span style='font-family:bitstream'>".my_id(_var($disk,'id'))."</span> - $size $unit ("._var($disk,'device').$powerstatevalue.")";
117124
}
118125
function assignment(&$disk) {
119126
global $var, $devs;
@@ -274,11 +281,7 @@ function array_online(&$disk, $fstype='') {
274281
default:
275282
$echo[] = "<td>".device_info($disk,true)."</td>";
276283
$echo[] = "<td>".device_desc($disk)."</td>";
277-
if ($disk['transport'] == "nvme") {
278-
$powerstate=getnvmepowerstate("/dev/".$disk['device']);
279-
$powerstatevalue="<br>PS: ".$powerstate['powerstatevalue']."(".$powerstate['powerstate'].")" ;
280-
} else $powerstatevalue = "" ;
281-
$echo[] = "<td>".my_temp(_var($disk,'temp','*')).$powerstatevalue."</td>";
284+
$echo[] = "<td>".my_temp(_var($disk,'temp','*'))."</td>";
282285
$echo[] = "<td><span class='diskio'>".my_diskio($data[0])."</span><span class='number'>".my_number(_var($disk,'numReads',0))."</span></td>";
283286
$echo[] = "<td><span class='diskio'>".my_diskio($data[1])."</span><span class='number'>".my_number(_var($disk,'numWrites',0))."</span></td>";
284287
$echo[] = "<td>".my_number(_var($disk,'numErrors',0))."</td>";
@@ -514,8 +517,17 @@ while (true) {
514517
$n++;
515518
$echo[$n] = _var($var,'fsState')=='Stopped' ? 1 : 0;
516519

517-
publish('devices', implode("\0",$echo));
518-
publish('arraymonitor', _var($var,'fsState')=='Started' ? 1 : 0);
520+
$echo = implode("\0",$echo);
521+
$md5_new = md5($echo,true);
522+
if ($md5_new !== $md5_old) {
523+
publish('devices', $echo);
524+
$md5_old = $md5_new;
525+
}
526+
$fs_new = _var($var,'fsState')=='Started' ? 1 : 0;
527+
if ($fs_new !== $fs_old) {
528+
publish('arraymonitor', $fs_new);
529+
$fs_old = $fs_new;
530+
}
519531
sleep(1);
520532
}
521533
?>

emhttp/plugins/dynamix/nchan/notify_poller

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,17 @@
1414
<?
1515
$docroot = '/usr/local/emhttp';
1616
$notify = "$docroot/webGui/scripts/notify";
17+
$md5_old = -1;
1718

1819
require_once "$docroot/webGui/include/publish.php";
1920

2021
while (true) {
21-
publish('notify', shell_exec("$notify get"));
22+
$echo = shell_exec("$notify get");
23+
$md5_new = md5($echo,true);
24+
if ($md5_new !== $md5_old) {
25+
publish('notify', $echo);
26+
$md5_old = $md5_new;
27+
}
2228
sleep(3);
2329
}
2430
?>

0 commit comments

Comments
 (0)