-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathPIT.bat
60 lines (53 loc) · 2.16 KB
/
PIT.bat
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
::--------------------------------------------------------------------
:: This script installs all necessary configuration
:: files as required to upload images to the PhenoCam server
:: (phenocam.nau.edu) on your NetCam SC/XL camera REMOTELY with
:: minimum interaction with the camera
::
:: last updated and maintained by:
:: Koen Hufkens (January 2014) [email protected]
::--------------------------------------------------------------------
@echo off
:: if the timezone is positive +
:: replace + with the escaped {+} character
set timezone=%5%
set timezone=%timezone:+={+}%
:: asign variable names
set ip=%1%
set login=%2%
set passwd=%3%
set name=%4%
set TZ=%6%
set cronstart=%7%
set cronend=%8%
set timestep=%9%
shift
set ftpmode=%9%
:: Create VBS script
echo set OBJECT=WScript.CreateObject("WScript.Shell") > sendCommands.vbs
echo WScript.sleep 500 >> sendCommands.vbs
echo OBJECT.SendKeys "%login%{ENTER}" >> sendCommands.vbs
echo WScript.sleep 500 >> sendCommands.vbs
echo OBJECT.SendKeys "%passwd%{ENTER}" >> sendCommands.vbs
echo WScript.sleep 500 >> sendCommands.vbs
echo OBJECT.SendKeys "cd /etc/config{ENTER}" >> sendCommands.vbs
echo WScript.sleep 500 >> sendCommands.vbs
echo OBJECT.SendKeys "wget http://phenocam.nau.edu/data/configs/phenocam_default_install.tar.gz{ENTER}" >> sendCommands.vbs
echo WScript.sleep 1000 >> sendCommands.vbs
echo OBJECT.SendKeys "gunzip phenocam_default_install.tar.gz{ENTER}" >> sendCommands.vbs
echo WScript.sleep 500 >> sendCommands.vbs
echo OBJECT.SendKeys "tar -xvf phenocam_default_install.tar{ENTER}" >> sendCommands.vbs
echo WScript.sleep 500 >> sendCommands.vbs
echo OBJECT.SendKeys "rm phenocam_default_install.tar{ENTER}" >> sendCommands.vbs
echo WScript.sleep 500 >> sendCommands.vbs
echo OBJECT.SendKeys "sh phenocam_install.sh %name% %timezone% %TZ% %cronstart% %cronend% %timestep% %ftpmode%{ENTER}" >> sendCommands.vbs
echo WScript.sleep 180000 >> sendCommands.vbs
echo OBJECT.SendKeys "exit{ENTER}" >> sendCommands.vbs
echo WScript.sleep 50 >> sendCommands.vbs
echo OBJECT.SendKeys " " >> sendCommands.vbs
:: Open a Telnet window
start telnet.exe %ip%
:: Run the script
cscript sendCommands.vbs
:: remove VBS script
del sendCommands.vbs