117 lines
4.5 KiB
PHP
117 lines
4.5 KiB
PHP
<?php
|
|
/*=======================================================================
|
|
*
|
|
* check_jb_permanent.auto.php
|
|
*
|
|
* Autor: Carsten Annacker
|
|
*
|
|
=======================================================================*/
|
|
|
|
// Execution-Time for script
|
|
set_time_limit(0);
|
|
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED);
|
|
|
|
include_once("../include/dbglobal.inc.php");
|
|
include_once("../include/caglobal.inc.php");
|
|
|
|
// Sicherstellen, dass auch wirklich nur ein Prozess läuft...
|
|
if ($argc > 0):
|
|
$cnt = 0;
|
|
exec("ps -fA", $output);
|
|
for ($i = 0; $i < count($output); $i++):
|
|
$pos = strpos ($output[$i], $argv[0]);
|
|
if (!($pos === false))
|
|
$cnt++;
|
|
endfor;
|
|
if ($cnt > 1):
|
|
echo "[" . date("Y-m-d H:i:s") . "] " . "$PHP_SELF: [" . $argv[0] . "] läuft schon...\n";
|
|
exit();
|
|
endif;
|
|
endif;
|
|
|
|
getDb2Connection(); // Try to connect request server because of performance
|
|
|
|
// Endless loop
|
|
while (TRUE):
|
|
|
|
//********************************************************************************
|
|
// Dinge, die zu einer bestimmten Uhrzeit passieren sollen
|
|
// Diese sind in eine Schleife eingebaut, die für mindestens x Minuten Verzögerung sorgt
|
|
|
|
for ($i = 0; $i < 2; $i++):
|
|
|
|
// if (date("H:i") == "23:45"):
|
|
// writeLog_("../log/check_jb_permanent_invtext_", "exiting...");
|
|
// exit();
|
|
// endif;
|
|
|
|
$sleep_time = 59 - date("s");
|
|
sleep($sleep_time);
|
|
while (date("s") != "00");
|
|
endfor;
|
|
|
|
/*
|
|
835489 //STE900608
|
|
203463 //STHH927621
|
|
//823978 //STF909226
|
|
//819825 //STDD908923
|
|
//833194 //STB975597
|
|
835016 //STS910215
|
|
832514 //STHB922142
|
|
819783 //STH910930
|
|
823862 //STE900608
|
|
838538, 839047, 836563, 839052, 839053, 839044, 839045, 838877, 839055, 839046, 839056, 836922, 839048, 839049, 836571, 838816
|
|
|
|
t:m:
|
|
cs_id cs_eid emp_id usr_id
|
|
833194 STB975597 834135 841591
|
|
819825 STDD908923 819943 825800
|
|
823862 STE900608 824266 830604
|
|
823978 STF909226 824386 830734
|
|
819783 STH910930 819901 825754
|
|
832514 STHB922142 833410 840785
|
|
203463 STHH927621 203464 208443
|
|
823922 STL908468 824329 830671
|
|
839904 STM900029 841607 850094
|
|
847829 STM900333 851375 861224
|
|
|
|
|
|
Daikin:
|
|
841784, 841782, 841783, 841785, 841786, 841787, 842129, 842128, 842195, 844750
|
|
|
|
ICS Group
|
|
854125, 854116, 854129, 854166, 854113, 854120, 854115, 854117, 854114, 854118
|
|
|
|
*/
|
|
// ALL !!!!!!!!!!
|
|
// foreach (array(835489, 203463, 835016, 832514, 819783, 823862, 836193, 836374, 836358, 836366, 836367, 836368, 836803, 838449, 838538, 839047, 836563, 839052, 839053, 839044, 839045, 838877, 839055, 839046, 839056, 836922, 839048, 839049, 836571, 838816, 839596, 839603, 833194, 819825, 823978, 823922, 839904, 839996, 841784, 841782, 841783, 841785, 841786, 841787, 842129, 842128, 842195, 844750, 847829, 854125, 854116, 854129, 854166, 854113, 854120, 854115, 854117, 854114, 854118) as $cs_id_tmp) {
|
|
|
|
// Daikin and ICS only
|
|
foreach (array(841784, 841782, 841783, 841785, 841786, 841787, 842129, 842128, 842195, 844750, 854125, 854116, 854129, 854166, 854113, 854120, 854115, 854117, 854114, 854118) as $cs_id_tmp) {
|
|
$system_result = "";
|
|
$cmd = "php ../tools/auto_response.php acapella7890 $cs_id_tmp >> ../log/auto_response.stdout+err 2>&1";
|
|
$ausgabe = system($cmd, $system_result);
|
|
writeLog_("../log/check_jb_permanent_invtext_", "Calling auto_response.php $cs_id_tmp: ausgabe='$ausgabe'");
|
|
}
|
|
|
|
// 21.07.2025: make all log-files belong to www-data
|
|
foreach(array("/srv/htdocs/stadtbote/log/","/srv/htdocs/stadtbote/service/LN_374893028394/") as $dir_name) {
|
|
if ($handle = opendir($dir_name)) {
|
|
while (false !== ($entry = readdir($handle))) {
|
|
//echo $entry . ", " . (fileowner($dir_name . $entry) == 0) . ", " . in_array(pathinfo($dir_name . $entry, PATHINFO_EXTENSION), array("log", "stdout+err", "err", "txt")) . "\n";
|
|
//print_r(posix_getpwuid(fileowner($filename)));
|
|
if (is_file($dir_name . $entry) && in_array(pathinfo($dir_name . $entry, PATHINFO_EXTENSION), array("log", "stdout+err", "err", "txt")) && fileowner($dir_name . $entry) == 0) {
|
|
if (!exec("chown www-data:www-data " . $dir_name . $entry))
|
|
echo "executing command [" . "chown www-data:www-data " . $dir_name . $entry . "] returned true\n";
|
|
else
|
|
echo "executing command [" . "chown www-data:www-data " . $dir_name . $entry . "] returned false\n";
|
|
}
|
|
}
|
|
closedir($handle);
|
|
}
|
|
}
|
|
//********************************************************************************
|
|
|
|
endwhile; // Endless loop
|
|
|
|
?>?
|