BackUpToFlash
|
Копирование резервной копии
$filename = ROOT . '/database_backup/db.sql';
$mysqlDumpPath = "/usr/bin/mysqldump";
$mysqlDumpParam = " --user=" . DB_USER . " --password=" . DB_PASSWORD;
$mysqlDumpParam .= " --no-create-db --add-drop-table --databases " . DB_NAME;
if (file_exists($filename)) rename($filename, $filename . '.prev');
exec($mysqlDumpPath . $mysqlDumpParam . " > " . $filename);
exec ("sudo mkdir -p /mnt/usb/backup_root");
exec ("sudo mount -p /dev/sda2 /mnt/usb/backup_root/");
exec ("sudo rsync -aHv --delete --delete-after --exclude-from=/home/pi/not_backup / /mnt/usb/backup_root/ 2>&1 &");
say("Сохранение выполнено",2);
|
checkFreeSpace
|
$max_usage=90; //%
$output=array();
exec('df',$output);
//var_dump($output);
$problems=0;
$problems_details='';
foreach($output as $line) {
if (preg_match('/(\d+)% (\/.+)/',$line,$m))
$proc=$m[1];
$path=$m[2];
if ($proc>$max_usage) {
$problems++;
$problems_details.="$path: $proc; ";
}
//echo "$path: $proc%<br/>";
}
sg("ThisComputer.SpaceProblems",$problems);
sg("ThisComputer.SpaceProblems_Details",$problems_details);
setTimeOut('checkFreeSpace','runScript("checkFreeSpace");',5*60);
|
rebootSystem
|
$filename = ROOT . '/database_backup/db.sql';
$mysqlDumpPath = "/usr/bin/mysqldump";
$mysqlDumpParam = " --user=" . DB_USER . " --password=" . DB_PASSWORD;
$mysqlDumpParam .= " --no-create-db --add-drop-table --databases " . DB_NAME;
if (file_exists($filename)) rename($filename, $filename . '.prev');
exec($mysqlDumpPath . $mysqlDumpParam . " > " . $filename);
say(LANG_GENERAL_STARTING_REBOOT,2);
setTimeout("shutdownTimer","safe_exec('shutdown -r now');",15);
|
shutDown
|
$filename = ROOT . '/database_backup/db.sql';
$mysqlDumpPath = "/usr/bin/mysqldump";
$mysqlDumpParam = " --user=" . DB_USER . " --password=" . DB_PASSWORD;
$mysqlDumpParam .= " --no-create-db --add-drop-table --databases " . DB_NAME;
if (file_exists($filename)) rename($filename, $filename . '.prev');
exec($mysqlDumpPath . $mysqlDumpParam . " > " . $filename);
say(LANG_GENERAL_STARTING_SHUTDOWN,2);
setTimeout("shutdownTimer","safe_exec('shutdown -h now');",15);
|
temp_lustra
|
include_once(DIR_MODULES . 'zigbee2mqtt/zigbee2mqtt.class.php');
$z2m = new zigbee2mqtt();
$z2m->sendcommand('zigbee2mqtt/0x54ef441000075a24/set', '{"state":"off"}');
|
WakeOnLine
|
include_once(DIR_MODULES . 'wol/wol.class.php');
$wake = new wol();
$wake->WakeOnLan('192.168.1.255','38:D5:47:78:3B:35');
|
test2 alisa
|
say("Сохранение выполнено ghbdt",5);
|
testAlisa
|
// callAPI('/api/module/yadevices','GET',array('station'=>1,'command'=>'setVolume','volume'=>6));
callAPI('/api/module/yadevices','GET',array('station'=>1,'say'=>'раз-два-три'));
callAPI('/api/module/yadevices','GET',array('station'=>1,'command'=>'повтори за мной раз-два-три'));
|
test_sip
|
GetURL("http://freeswitch:works@192.168.1.121:7070/webapi/originate?user/1002%203002");
GetURL("http://freeswitch:works@192.168.1.121:7070/webapi/originate?user/1009%203002");
sleep (10);
GetURL("http://freeswitch:works@192.168.1.121:7070/webapi/conference?3002-192.168.1.121%20kick%20all");
|