-
Notifications
You must be signed in to change notification settings - Fork 0
/
wecker.php
71 lines (57 loc) · 1.86 KB
/
wecker.php
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>SmartWecker</title>
<link rel="icon"
type="image/ico"
href="favicon.ico">
<!-- import custom stylesheet -->
<link rel="stylesheet" media="screen" href="design.css">
</head>
<body>
<form action="" method="get">
<p id="default">
Weckzeit eingeben HH : MM
<br><br>
<input type="time" name="alarmTime" required="required">
<br><br>
<input type="submit" value="Wecker stellen">
</p>
</form>
<p id="default">
<b>Weitere Funktionen: </b> <br><br>
<a href="weckerConfig.html">Wecker konfigurieren</a> <br>
<a href="index.html">Home</a> <br>
</p>
<?php
//add all commands to crontab
$alarmTime = $_GET['alarmTime'];
$timeFile = fopen('/var/www/beta/time.txt', w);
// Schreibe Stunde
fwrite ( $timeFile, $alarmTime );
fclose($timeFile);
if ($alarmTime != "") //print success message if everything was ok
{
echo '<p id="default"> Wecker auf ' . $alarmTime . ' gestellt. <br> </p>';
}
/*
$cronCmd = 'command="/var/www/beta/alarmClock.sh"
job="' . $mins . ' ' . $hour . ' * * 0 $command "
cat <(fgrep -i -v "$command" <(crontab -l)) <(echo "$job") | crontab -';
$cronJobMaker = fopen('/var/www/beta/cronJobMaker.sh', w);
fwrite($cronJobMaker, "#!/bin/bash \n"); //write shebang
fwrite($cronJobMaker, $cronCmd);
fclose($cronJobMaker);
*/
/*shell_exec('var/www/beta/cronJobMaker.sh');
echo 'error: ' . $error . '<br>';
echo $cmd . '<br>';
echo $croncmd . '<br>';
echo $hour . '<br>';
echo $mins . '<br>';*/
//exec('echo | crontab -');
//"'.$mins.' '.$hour.' * * * echo mode=0 > /dev/led-blaster; echo time=' . $fadeTime . ' /dev/led-blaster; ; ; ; echo b=100 > /dev/led-blaster;
?>
</body>
</html>