-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcron.php
More file actions
38 lines (29 loc) · 955 Bytes
/
cron.php
File metadata and controls
38 lines (29 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php // ##### CRONTAB CALL EVERY 5 MINUTES #####
if (!isset($_SERVER['argv'])) die('No.'); // Only PHP CLI may use this file.
require_once 'config.php';
date_default_timezone_set($config['location']['timezone']);
set_time_limit(0); // Do not limit time for large scripts
$time_now = time(); // Save the time() in a var for when a part of the script takes more then a minute to process
$chan = 5;
$comm_up = 0;
$comm_stop = 1;
$comm_down = 2;
// Once every day on a specific hour
if (date('H:i', $time_now) == '08:00')
{
$fh = fopen('http://' . $config['ArduinoBlindsControl']['ip'] . '/?chan' . $chan . ',' . $comm_up . ',20000', 'rb');
if ($fh)
{
$content = stream_get_contents($fh);
fclose($fh);
}
}
if (date('H:i', $time_now) == '22:00')
{
$fh = fopen('http://' . $config['ArduinoBlindsControl']['ip'] . '/?chan' . $chan . ',' . $comm_down . ',20000', 'rb');
if ($fh)
{
$content = stream_get_contents($fh);
fclose($fh);
}
}