#!/usr/bin/python # # Upload file to VM server at 199.188.100.82 # # import paramiko import sys import update_server if len(sys.argv) != 3: print "Use: uploadfile.py local_file remote_file" sys.exit() lf, rf = sys.argv[1:3] update_server.upload( lf, rf)
#!/usr/bin/python # # Script to be run to save # sensor data on server VM 199.188.100.82 # and then cause plots to be generated there import os import update_server path = "/home/pi/house_monitor_files" os.chdir( path ) update_server.upload( "t1.txt", "data/t1.txt") update_server.upload( "t2.txt", "data/t2.txt") update_server.shell( "bin/plot.py" )
#!/usr/bin/python # # Script run by cron to take and save # photo in /home/pi/house_monitor_files/images/current_image.jpg # and send to VPS server under name composed with date string. import os import time import update_server sample_time = time.localtime(time.time()) remotefilename = "image_" + time.strftime( "%Y-%m-%d_%H:%M:%S", sample_time) + ".jpg" remotepathname = "images/" + remotefilename #print "Filename: " + remotefilename localpathname = "/home/pi/house_monitor_files/images/current_image.jpg" os.system("raspistill -vf -hf -w 300 -h 300 -o " + localpathname) # print "Uploading file: " + localpathname + " to VPS as " + remotepathname update_server.upload( localpathname, remotepathname) # Link this image to current_image update_server.shell( "rm images/current_image.jpg;ln -s " + remotefilename + " images/current_image.jpg")