-
Notifications
You must be signed in to change notification settings - Fork 1
/
timelapse-start.php
54 lines (46 loc) · 1.43 KB
/
timelapse-start.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
<?php
include 'includes/checklogin.php';
if(( isset($_POST['sleeptime'], $_POST['rollname'])
AND
strcmp(trim($_POST['sleeptime']),'') != 0
AND
strcmp(trim($_POST['rollname']),'') != 0 ) )
{
session_start();
$sleeptime=trim($_POST['sleeptime']);
$rollname=trim($_POST['rollname']);
$_SESSION['rollname']=$rollname;
$_SESSION['sleeptime']=$sleeptime;
if (file_exists('/var/www/capture/usb/'.$rollname.'/'))
{
header( 'Location: timelapse.php?error=1');
exit();
}
if (mkdir("/var/www/capture/usb/".$rollname."/", 0777))
{
// NOP ->echo "OK";
}
else
{
header( 'Location: timelapse.php?error=2');
exit();
}
file_put_contents('/var/www/capture/usb/tlstatus', "1\n".$rollname."\n".$sleeptime."\n");
$command="/var/www/cmd/wwwtimelapse ".$rollname." ".$sleeptime;
echo $command;
echo "<br>";
//shell_exec($command);
//shell_exec($command . ' 2>&1 > /var/www/capture/usb/out.log');
exec($command . " > /var/www/capture/usb/".$rollname."/".$rollname.".log &");
//print_r($return)
header( 'Location: timelapse.php' );
exit();
}
else
{
ECHO "ROLL=".$_POST['rollname']."</BR>";
ECHO "sleeptime=".$_POST['sleeptime']."</BR>";
//header( 'Location: timelapse.php' );
//exit();
}
?>