first commit
This commit is contained in:
Executable
+155
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Rui Santos
|
||||
Complete project details at https://RandomNerdTutorials.com/esp32-esp8266-mysql-database-php/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
*/
|
||||
|
||||
$servername = "localhost";
|
||||
|
||||
// REPLACE with your Database name
|
||||
$dbname = "sensors";
|
||||
// REPLACE with Database user
|
||||
$username = "sensors";
|
||||
// REPLACE with Database user password
|
||||
$password = "datel123";
|
||||
|
||||
// Keep this API Key value to be compatible with the ESP32 code provided in the project page.
|
||||
// If you change this value, the ESP32 sketch needs to match
|
||||
$api_key_value = "tPmAT5Ab3j7F9";
|
||||
|
||||
$conn = new mysqli($servername, $username, $password, $dbname);
|
||||
if (isset($_GET['api_key'])) {
|
||||
|
||||
|
||||
|
||||
|
||||
$api_key= $sensor = $location = $value1 = $value2 = $value3 = "";
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "GET") {
|
||||
$api_key = test_input($_GET["api_key"]);
|
||||
if($api_key == $api_key_value) {
|
||||
$sensor = test_input($_GET["sensor"]);
|
||||
$location = test_input($_GET["location"]);
|
||||
$value1 = test_input($_GET["value1"]);
|
||||
$value2 = test_input($_GET["value2"]);
|
||||
$value3 = test_input($_GET["value3"]);
|
||||
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
|
||||
$sqlnew = "select location as light from SensorData where sensor like '$sensor' ORDER BY id DESC LIMIT 1";
|
||||
if ($result = $conn->query($sqlnew)) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
$row_light = $row["light"];
|
||||
}
|
||||
$result->free();
|
||||
}
|
||||
|
||||
|
||||
|
||||
$percent = (1 - $location / $row_light) * 100;
|
||||
|
||||
//$percent = 0 - $percent;
|
||||
|
||||
$anone = number_format($percent, 0);
|
||||
$anone = 0 - $anone;
|
||||
// echo $location."<br>";
|
||||
// echo $row_light."<br>";
|
||||
// echo $anone;
|
||||
|
||||
|
||||
if($anone >=80 ){
|
||||
$location = $row_light;
|
||||
}
|
||||
|
||||
//echo "konec:".$location;
|
||||
|
||||
$sql = "INSERT INTO SensorData (sensor, location, value1, value2, value3)
|
||||
VALUES ('" . $sensor . "', '" . $location . "', '" . $value1 . "', '" . $value2 . "', '" . $value3 . "')";
|
||||
|
||||
if ($conn->query($sql) === TRUE) {
|
||||
echo "New record created successfully";
|
||||
}
|
||||
else {
|
||||
echo "Error: " . $sql . "<br>" . $conn->error;
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
}
|
||||
else {
|
||||
echo "Wrong API Key provided.";
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
echo "No data posted with HTTP POST.";
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
$sql = "SELECT id, sensor, location, value1, value2, value3, reading_time FROM SensorData order by reading_time desc limit 10";
|
||||
|
||||
echo '<table cellspacing="0" cellpadding="5" border="0" align="center">
|
||||
<tr>
|
||||
<td>Kde</td>
|
||||
<td>Svetlo</td>
|
||||
<td>Vlhkost</td>
|
||||
<td>Teplota</td>
|
||||
<td>Tlak</td>
|
||||
<td>Timestamp</td>
|
||||
</tr>';
|
||||
|
||||
if ($result = $conn->query($sql)) {
|
||||
while ($row = $result->fetch_assoc()) {
|
||||
// $row_id = $row["id"];
|
||||
$row_sensor = $row["sensor"];
|
||||
$row_location = $row["location"];
|
||||
$row_value1 = $row["value1"];
|
||||
$row_value2 = $row["value2"];
|
||||
$row_value3 = $row["value3"];
|
||||
$row_reading_time = $row["reading_time"];
|
||||
//$row_reading_time = date("Y-m-d H:i:s", strtotime("$row_reading_time + 4 hours"));
|
||||
|
||||
if($row_sensor == "Byt"){
|
||||
echo '<tr bgcolor="red">
|
||||
<td>' . $row_sensor . '</td>
|
||||
<td>' . $row_location . '</td>
|
||||
<td>' . $row_value1 . '</td>
|
||||
<td>' . $row_value2 . '</td>
|
||||
<td>' . $row_value3 . '</td>
|
||||
<td>' . date("l dS \o\f F Y h:i:s A",strtotime("$row_reading_time")) . '</td>
|
||||
</tr>';
|
||||
} else {
|
||||
echo '<tr>
|
||||
<td>' . $row_sensor . '</td>
|
||||
<td>' . $row_location . '</td>
|
||||
<td>' . $row_value1 . '</td>
|
||||
<td>' . $row_value2 . '</td>
|
||||
<td>' . $row_value3 . '</td>
|
||||
<td>' . date("l dS \o\f F Y h:i:s A",strtotime("$row_reading_time")) . '</td>
|
||||
</tr>';
|
||||
}
|
||||
}
|
||||
$result->free();
|
||||
}
|
||||
|
||||
$conn->close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function test_input($data) {
|
||||
$data = trim($data);
|
||||
$data = stripslashes($data);
|
||||
$data = htmlspecialchars($data);
|
||||
return $data;
|
||||
}
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
$MyVariable="CZC94881W3"
|
||||
echo $MyVariable
|
||||
Get-Service -Name klnagent -ComputerName $MyVariable
|
||||
Get-Service -Name klnagent -ComputerName $MyVariable | Set-Service -Status Running
|
||||
Get-Service -Name klnagent -ComputerName $MyVariable
|
||||
Executable
+50
@@ -0,0 +1,50 @@
|
||||
$FOLDER = 'C:\TMP'
|
||||
$MICRO = 'C:\Program Files (x86)\Trend Micro\Security Agent\PccNTMon.exe'
|
||||
$FOLDERS = 'C:\Sony\Sonaps'
|
||||
|
||||
if (Test-Path -Path $FOLDER) {
|
||||
"Adresar TMP existuje"
|
||||
} else {
|
||||
mkdir c:\TMP
|
||||
}
|
||||
|
||||
Get-WmiObject -Class Win32_Product | where Name -like ("Kaspersky Endpoint Security*") |select IdentifyingNumber | ft -hide > C:\TMP\uuid_kasp.txt
|
||||
(gc C:\TMP\uuid_kasp.txt ) | ? {$_.trim() -ne "" } | set-content C:\TMP\uuid_kasp.txt
|
||||
$KES = Get-Content -Path C:\TMP\uuid_kasp.txt -TotalCount 1
|
||||
if ($KES) {
|
||||
start-Process -FilePath "$env:systemroot\system32\msiexec.exe" -ArgumentList '/x', $KES, 'KLLOGIN=KLAdmin', 'KLPASSWD=I.*nform1976', '/qn' -Wait
|
||||
} else {
|
||||
"Nenalezen : Kaspersky Endpoint Security pro systém Windows"
|
||||
}
|
||||
|
||||
Get-WmiObject -Class Win32_Product | where Name -eq "Kaspersky Security Center Network Agent" |select IdentifyingNumber | ft -hide > C:\TMP\uuid_netagent.txt
|
||||
(gc C:\TMP\uuid_netagent.txt ) | ? {$_.trim() -ne "" } | set-content C:\TMP\uuid_netagent.txt
|
||||
$AGENT = Get-Content -Path C:\TMP\uuid_netagent.txt -TotalCount 1
|
||||
|
||||
if ($AGENT) {
|
||||
cp \\pn03\Instalace\Kaspersky\Cleaner\cleaner.exe c:\TMP\
|
||||
start-Process -FilePath "C:\TMP\cleaner.exe" -ArgumentList '/pc', $AGENT
|
||||
} else {
|
||||
"Nenalezen : Kaspersky Security Center Network Agent"
|
||||
}
|
||||
|
||||
|
||||
if (Test-Path -Path $MICRO ) {
|
||||
"Antivir je jiz naistalovany"
|
||||
} else {
|
||||
|
||||
if (Test-Path -Path $FOLDERS) {
|
||||
Write-Output "Počítč má adresáč $FOLDERS"
|
||||
$parms=@("/quiet", "/norestart" , "/lv", "C:\ApexOne.log";"/i";"\\pn03\Instalace\TrendMicro\Agents\AgentsApexCentral\Standalone\sonaps_agent_cloud_x64.msi")
|
||||
(Start-Process -FilePath "$env:systemroot\system32\msiexec.exe" -ArgumentList $parms -Wait -Passthru).ExitCode
|
||||
|
||||
}else{
|
||||
Write-Output "Počítč NEmá adresáč $FOLDERS"
|
||||
$parms=@("/quiet", "/norestart" , "/lv", "C:\ApexOne.log";"/i";"\\pn03\Instalace\TrendMicro\Agents\AgentsApexCentral\Standalone\agent_cloud_x64.msi")
|
||||
(Start-Process -FilePath "$env:systemroot\system32\msiexec.exe" -ArgumentList $parms -Wait -Passthru).ExitCode
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Wait-Event -SourceIdentifier "ProcessStarted" -Timeout 30
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
$serverlist = get-content ServerList.txt
|
||||
#$file = debug.txt
|
||||
foreach ($server in $serverlist) {
|
||||
if (@(Get-ADComputer $server -ErrorAction SilentlyContinue).Count) {
|
||||
$errorActionPreference = "SilentlyContinue"
|
||||
|
||||
}
|
||||
else {
|
||||
Write-Host $server
|
||||
#$server | Out-File $file
|
||||
write-output $server | add-content $home\Desktop\NejsouVAD.txt
|
||||
}
|
||||
}
|
||||
Executable
+37
@@ -0,0 +1,37 @@
|
||||
function check-chassis {
|
||||
BEGIN {}
|
||||
PROCESS {
|
||||
#Write-Output "Processing $_ which is a:-"
|
||||
$computer = "$_"
|
||||
$chassis = Get-WmiObject win32_systemenclosure -computer $computer | select chassistypes
|
||||
if ($chassis.chassistypes -contains '3'){Write-Output "Desktop"}
|
||||
elseif ($chassis.chassistypes -contains '4'){Write-Output "Low Profile Desktop"}
|
||||
elseif ($chassis.chassistypes -contains '5'){Write-Output "Pizza Box"}
|
||||
elseif ($chassis.chassistypes -contains '6'){Write-Output "Mini Tower"}
|
||||
elseif ($chassis.chassistypes -contains '7'){Write-Output "Tower"}
|
||||
elseif ($chassis.chassistypes -contains '8'){Write-Output "Portable"}
|
||||
elseif ($chassis.chassistypes -contains '9'){Write-Output "Laptop"}
|
||||
elseif ($chassis.chassistypes -contains '10'){Write-Output "Notebook"}
|
||||
elseif ($chassis.chassistypes -contains '11'){Write-Output "Hand Held"}
|
||||
elseif ($chassis.chassistypes -contains '12'){Write-Output "Docking Station"}
|
||||
elseif ($chassis.chassistypes -contains '13'){Write-Output "All in One"}
|
||||
elseif ($chassis.chassistypes -contains '14'){Write-Output "Sub Notebook"}
|
||||
elseif ($chassis.chassistypes -contains '15'){Write-Output "Space-Saving"}
|
||||
elseif ($chassis.chassistypes -contains '16'){Write-Output "Lunch Box"}
|
||||
elseif ($chassis.chassistypes -contains '17'){Write-Output "Main System Chassis"}
|
||||
elseif ($chassis.chassistypes -contains '18'){Write-Output "Expansion Chassis"}
|
||||
elseif ($chassis.chassistypes -contains '19'){Write-Output "Sub Chassis"}
|
||||
elseif ($chassis.chassistypes -contains '20'){Write-Output "Bus Expansion Chassis"}
|
||||
elseif ($chassis.chassistypes -contains '21'){Write-Output "Peripheral Chassis"}
|
||||
elseif ($chassis.chassistypes -contains '22'){Write-Output "Storage Chassis"}
|
||||
elseif ($chassis.chassistypes -contains '23'){Write-Output "Rack Mount Chassis"}
|
||||
elseif ($chassis.chassistypes -contains '24'){Write-Output "Sealed-Case PC"}
|
||||
else {Write-output "Unknown"}
|
||||
|
||||
}
|
||||
END{}
|
||||
}
|
||||
|
||||
$a = "localhost" | check-chassis
|
||||
|
||||
Write-output $a
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
# Instalace
|
||||
# pip install broadlink
|
||||
# pip install cryptography
|
||||
|
||||
import broadlink
|
||||
|
||||
devices1 = broadlink.sp2(devtype = 0x7547, host=("192.168.15.109",80), mac=bytearray.fromhex("34 EA 34 BD 75 02"))
|
||||
devices1.auth()
|
||||
devices1.set_power(True)
|
||||
# OFF - devices1.set_power(False)
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/python3
|
||||
from datetime import datetime, time
|
||||
now = datetime.now()
|
||||
now_time = now.time()
|
||||
|
||||
|
||||
|
||||
if now_time >= time(6,00) and now_time <= time(22,00):
|
||||
print ('0')
|
||||
else:
|
||||
print ('1')
|
||||
|
||||
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
|
||||
|
||||
ls | while read line; do sed -i 's/85.239.69.9/85.239.69.7/g' $line; done
|
||||
|
||||
grep -rnw * -e "85.239.69.7" | awk '{ print $1 }' | cut -d ":" -f 1 | sort | uniq | while read line; do sed -i 's/[0-9]\{10\}/2022080301/' $line; done
|
||||
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
hodina=`date +%H`
|
||||
datum=`date +%y%m%d`
|
||||
cd /root/energetika
|
||||
EXISTUJE=`find /var/www/html/cloud.mstefl.cz/data/jana/files -iname "*$datum*" | wc -l`
|
||||
|
||||
|
||||
|
||||
if [ "$hodina" = "08" ] || [ "$hodina" = "09" ]; then
|
||||
# echo "Hodna pro spusteni";
|
||||
if [ $EXISTUJE -eq 0 ]
|
||||
then
|
||||
#echo "Budu stahovat soubor";
|
||||
wget --user=newton --password=HESLO ftp://ftp.newtonit.cz/"/zce/vstup/Nová energetika/ČEZ - medan interně-"$datum"-0830-Přehled.zip" > /dev/null 2>&1
|
||||
if [ -f "/root/energetika/ČEZ - medan interně-$datum-0830-Přehled.zip" ];
|
||||
then
|
||||
mv "ČEZ - medan interně-$datum-0830-Přehled.zip" /var/www/html/cloud.mstefl.cz/data/jana/files/Energetika/Updates/
|
||||
chown www-data:www-data /var/www/html/cloud.mstefl.cz/data/jana/files/Energetika/Updates/*.zip
|
||||
cd /var/www/html/cloud.mstefl.cz
|
||||
sudo -u www-data php occ files:scan jana
|
||||
wget https://api.pushover.net/1/messages.json --post-data="token=aserhn7trotowcj2xpqowwgyhvmwfi&user=uty4zaivtntn4wuazi724hy18p961u&message=Jsou nahrana nova data&title=Energetika" -qO- > /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
fi
|
||||
fi
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
apt -y install sudo
|
||||
|
||||
useradd -m -d /home/ansict -s /bin/bash -c "Ansible CT" -U ansict
|
||||
sudo usermod -aG sudo ansict
|
||||
echo "ansict ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
|
||||
mkdir /home/ansict/.ssh
|
||||
echo "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQD7GiVOT4oUwFXsRyAmu5LJx2imW0zMpbVSZg5sa3WDvRLHUk10e7Ch+9SzvusbljlLV31M685cmHzZhSxrGqZR9R7TnhEdZb2QVKTRLBEmL4C2o6wOF+4FKEkOrSr7msDHcwvKN9lDib0MGyvLqZd2MXclAtE+yCvwvvbwOpLztPwyFKvFuBW9PtZ0KFYYxMIxwjOMrzCmb0hlWCnhnmNh08PTR1AT7Sdz8YlMIOYEjTxzRCW8nemjtrpydoBH05q8luqS6LxB4yj2kscSBB10eOviQ6FUQBg3ob0xe3KdCUPq7o2eUah+HDAZOy3MVd+uAuogzCMnpot0VGX+vmWAcV0iwBU0CEHJl12dK6CsMCETX3cjVQqQOueCh9biav9XzbbWDkIfrx871+os15izK03o3LcTZU7sDxkzeYha6/U1Z+5wPGXHTwcwMLsxn98W04rBor2ugVs+j+iKo9P8nTiOXO1Ngq4YrLuBqgJytJScoU72l4DN+CDpl0mP2K0= ansict@ansitest" > /home/ansict/.ssh/authorized_keys2
|
||||
chown -R ansict:ansict /home/ansict
|
||||
cp /etc/ssh/sshd_config /etc/ssh/sshd_config_backup
|
||||
|
||||
echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
|
||||
echo "AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2" >> /etc/ssh/sshd_config
|
||||
|
||||
systemctl restart sshd
|
||||
Executable
+36
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
|
||||
JANA=`find /var/www/html/cloud.mstefl.cz/data/jana/files/ -mtime -1 | wc -l`
|
||||
JEIBICHOVA=`find /var/www/html/cloud.mstefl.cz/data/jeibichova/files/ -mtime -1 | wc -l`
|
||||
|
||||
find /var/www/html/cloud.mstefl.cz/data/jana/files/ -mtime -1 | wc -l > /mnt/backup/pocty_jana.txt
|
||||
find /var/www/html/cloud.mstefl.cz/data/jeibichova/files/ -mtime -1 | wc -l > /mnt/backup/pocty_jeibichova.txt
|
||||
|
||||
DATUM=`date +%d%m%Y`;
|
||||
DEN=`date +%d`
|
||||
|
||||
|
||||
if [ "$DEN" = "01" ]; then
|
||||
tar -cf /mnt/backup/jana_$DATUM.tar --absolute-names /var/www/html/cloud.mstefl.cz/data/jana/files/ > /dev/null 2>&1 &
|
||||
tar -cf /mnt/backup/jeibichova_$DATUM.tar --absolute-names /var/www/html/cloud.mstefl.cz/data/jeibichova/files/ > /dev/null 2>&1 &
|
||||
echo "1" > /mnt/backup/pocty_jana.txt
|
||||
echo "1" > /mnt/backup/pocty_jeibichova.txt
|
||||
wget https://api.pushover.net/1/messages.json --post-data="token=aserhn7trotowcj2xpqowwgyhvmwfi&user=uty4zaivtntn4wuazi724hy18p961u&message=Probehla pla mesicni zaloha&title=Zaloha na cloudU" -qO- > /dev/null 2>&1 &
|
||||
else
|
||||
if [[ $JANA != 0 ]]; then
|
||||
find /var/www/html/cloud.mstefl.cz/data/jana/files/ -mtime -1 -type f -print0 | xargs -0 tar -cvzf /mnt/backup/jana_$DATUM.tar --absolute-names > /dev/null 2>&1 &
|
||||
wget https://api.pushover.net/1/messages.json --post-data="token=aserhn7trotowcj2xpqowwgyhvmwfi&user=uty4zaivtntn4wuazi724hy18p961u&message=Probehla inkrementalni zaloha Jana&title=Zaloha na cloudU" -qO- > /dev/null 2>&1 &
|
||||
else
|
||||
wget https://api.pushover.net/1/messages.json --post-data="token=aserhn7trotowcj2xpqowwgyhvmwfi&user=uty4zaivtntn4wuazi724hy18p961u&message=U uzivatele Jana nedoslo ke zmene&title=Zaloha na cloudU" -qO- > /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
if [[ $JEIBICHOVA != 0 ]]; then
|
||||
find /var/www/html/cloud.mstefl.cz/data/jeibichova/files/ -mtime -1 -type f -print0 | xargs -0 tar -cvzf /mnt/backup/jeibichova_$DATUM.tar --absolute-names > /dev/null 2>&1 &
|
||||
wget https://api.pushover.net/1/messages.json --post-data="token=aserhn7trotowcj2xpqowwgyhvmwfi&user=uty4zaivtntn4wuazi724hy18p961u&message=Probehla inkrementalni zaloha Jeibichova&title=Zaloha na cloudU" -qO- > /dev/null 2>&1 &
|
||||
else
|
||||
|
||||
wget https://api.pushover.net/1/messages.json --post-data="token=aserhn7trotowcj2xpqowwgyhvmwfi&user=uty4zaivtntn4wuazi724hy18p961u&message=U uzivatele Jeibichova nedoslo ke zmene&title=Zaloha na cloudU" -qO- > /dev/null 2>&1 &
|
||||
fi
|
||||
fi
|
||||
|
||||
find /mnt/backup/ -type f -mtime +15 -exec rm -f {} +
|
||||
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
|
||||
DATUM=`date +%d%m%Y`
|
||||
|
||||
|
||||
scp -P 2282 mstefl@cloud.eibichova.cz:/mnt/backup/pocty_jana.txt /var/samba/backup/cloud/jana
|
||||
scp -P 2282 mstefl@cloud.eibichova.cz:/mnt/backup/pocty_jeibichova.txt /var/samba/backup/cloud/jana
|
||||
|
||||
JANA=`cat /var/samba/backup/cloud/jana/pocty_jana.txt`
|
||||
JEIBICHOVA=`cat /var/samba/backup/cloud/jana/pocty_jeibichova.txt`
|
||||
|
||||
|
||||
if [[ $JANA != 0 ]]; then
|
||||
scp -P 2282 mstefl@cloud.eibichova.cz:/mnt/backup/jana_$DATUM.tar /var/samba/backup/cloud/jana
|
||||
wget https://api.pushover.net/1/messages.json --post-data="token=aserhn7trotowcj2xpqowwgyhvmwfi&user=uty4zaivtntn4wuazi724hy18p961u&message=Byla stazena data Jana&title=Stazeni zalohy" -qO- > /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
if [[ $JEIBICHOVA != 0 ]]; then
|
||||
scp -P 2282 mstefl@cloud.eibichova.cz:/mnt/backup/jeibichova_$DATUM.tar /var/samba/backup/cloud/jeibichova
|
||||
wget https://api.pushover.net/1/messages.json --post-data="token=aserhn7trotowcj2xpqowwgyhvmwfi&user=uty4zaivtntn4wuazi724hy18p961u&message=Byla stazena data Jeibichova&title=Stazeni zalohy" -qO- > /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
find /var/samba/backup/cloud/ -type f -mtime +30 -exec rm -f {} +
|
||||
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
python /usr/local/bin/disk_on.py
|
||||
sleep 10
|
||||
sudo mount UUID=570d6099-accd-41e6-8870-0c1fbee5198f /mnt/usbdisk/
|
||||
|
||||
DATUM=`date +%d%m%Y`
|
||||
|
||||
scp -P 2282 mstefl@cloud.eibichova.cz:/mnt/backup/pocty_jana.txt /mnt/usbdisk/backup/
|
||||
scp -P 2282 mstefl@cloud.eibichova.cz:/mnt/backup/pocty_jeibichova.txt /mnt/usbdisk/backup/
|
||||
|
||||
JANA=`cat /mnt/usbdisk/backup/pocty_jana.txt`
|
||||
JEIBICHOVA=`cat /mnt/usbdisk/backup/pocty_jeibichova.txt`
|
||||
|
||||
if [[ $JANA != 0 ]]; then
|
||||
scp -P 2282 mstefl@cloud.eibichova.cz:/mnt/backup/jana_$DATUM.tar /mnt/usbdisk/backup/cloud/jana/
|
||||
wget https://api.pushover.net/1/messages.json --post-data="token=aserhn7trotowcj2xpqowwgyhvmwfi&user=uty4zaivtntn4wuazi724hy18p961u&message=Byla stazena data Jana&title=Stazeni zalohy" -qO- > /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
if [[ $JEIBICHOVA != 0 ]]; then
|
||||
scp -P 2282 mstefl@cloud.eibichova.cz:/mnt/backup/jeibichova_$DATUM.tar /mnt/usbdisk/backup/cloud/jeibichova/
|
||||
wget https://api.pushover.net/1/messages.json --post-data="token=aserhn7trotowcj2xpqowwgyhvmwfi&user=uty4zaivtntn4wuazi724hy18p961u&message=Byla stazena data Jeibichova&title=Stazeni zalohy" -qO- > /dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
sudo umount /mnt/usbdisk/
|
||||
sleep 10
|
||||
|
||||
python /usr/local/bin/disk_off.py
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
# Pro jednoho
|
||||
ldapsearch -LLL -b "DC=ct,DC=czech-tv,DC=cz" -D "CN=Ldap ADReader,OU=ServisniUzivatele,OU=Admins,DC=ct,DC=czech-tv,DC=cz" -H "ldap://ct.czech-tv.cz" -w Buchtickyses0do "(&(objectClass=Person)(sAMAccountName=sm233387))"
|
||||
|
||||
# Smycka
|
||||
cat users.txt | while read line; do ldapsearch -LLL -b "DC=ct,DC=czech-tv,DC=cz" -D "CN=Ldap ADReader,OU=ServisniUzivatele,OU=Admins,DC=ct,DC=czech-tv,DC=cz" -H "ldap://ct.czech-tv.cz" -w Buchtickyses0do "(&(objectClass=Person)(sAMAccountName=$line))" | grep "mail:"; done
|
||||
Reference in New Issue
Block a user