Through Dropbox…


Monitor your Computer Remotely with Dropbox

Remote Monitoring, not Remote Access

The idea behind using Dropbox for remote monitoring is fairly simple.

If you take a screen capture of your desktop screen and place that image in one of the Dropbox folders on your computer, the image will automatically get uploaded to the Dropbox website.

Repeat the screen capture process at regular intervals and you’ll get a time-lapse like recording of your desktop screen that you can view from any Internet connected computer or mobile phone since everything is now on dropbox.com.

First, you need to download Screen Grabber – a free screen capture utility that will save the screenshots directly in your Dropbox folder.

Next we need a mechanism that will capture screenshots at regular intervals. For that, you can use the following Autohotkey script* that runs in the background and will press the hotkey for you at set intervals.

Loop
{
Send, { SHIFTDOWN }{ F10 }{ SHIFTUP }
Sleep, 300000
}

If you have never used Autohotkey before, simply download and run this executable – dropbox-capture.zip – it’s a compiled version of the above script.

The default hotkey for Screen Grabber is Shift+F10. This script will press that hotkey and then wait for 5 minutes (5x60x1000) in a cycle. As new images get captured, they are simultaneously uploaded online.

Run this utility on any desktop that you want to monitor remotely and you’ll soon have a stream of screenshots in your Dropbox account as shown below. Everything runs quietly in the background so most people won’t notice any activity.

When you lock your workstation, the screen capture process is suspended but it resumes automatically as soon as you log in. You can run this tool on your office desktop and lock the workstation – if you find any screenshots in your Dropbox stream the next day, someone else probably used that machine.

Use Dropbox to Test your Website Locally

If you can move your local development folder to the Dropbox public folder, you don’t have to worry about uploading files to an FTP server as Dropbox will do that for you.

As soon as you change code in the local file, the changes get uploaded online to Dropbox servers almost immediately and you can use the “public link” in Dropbox to open and test that file in your web browser. Dropbox can understand relative URLs and hence your associated JS and CSS files will also get picked up without you having to specify the full path.

In other words, you code websites on a local computer but test them online just like the real environment. This technique may however not be used for testing PHP and other non-HTML sites.

Automatically Backup your Files with Dropbox

Backup with Dropbox is effortless but one big limitation is that your files and folders need to be residing inside the main Dropbox folder before they can be sent to the cloud.

To deal with this problem, we’ll make use of Microsoft SyncToy, a free application that keeps files and folders in sync with each other. You identify all the essential folders that you want to backup and then sync them all with the local Dropbox folder using SyncToy.

Backup your WordPress Blog to Dropbox

wpTimeMachine is another useful WordPress plugin that makes it easy for you to backup your entire WordPress blog to your Dropbox account. It can perform an automatic backup of your WordPress MySQL database, themes, plug-ins and all the other files and images that you may uploaded to your WordPress folder.

After you have installed the plugin, just enter your Dropbox credentials and hit the Generate Archive button. Within minutes (the time may vary depending upon the size of your WordPress site), you should see the backups in your Dropbox folder.

Print Files on Linux Remotely using Dropbox

If you have a printer attached to a Linux machine, you can easily send print jobs to that printer from another remote computer using Dropbox.

The idea is that you create a shell script to monitor a local Dropbox folder. As soon as a new file is added to that folder from a remote computer (or mobile phone), the script will send the file to the attached printer. Once the the printing job is completed, the file is removed from the incoming queue.

You only have to setup a cron job against this script such that it runs after every ‘n’ seconds (or minutes).

#!/bin/bash
export PrintQueue=”/root/Dropbox/PrintQueue”;
IFS=$’\n’
for PrintFile in $(/bin/ls -1 ${PrintQueue}) do
lpr -r ${PrintQueue}/${PrintFile};
done

To initiate a print job, simply add some files to the PrintQueue Folder in Dropbox from either a remote computer or upload them via your mobile phone. Within seconds, the script will start printing the files to your local printer.

If you have multiple printers attached to Linux computer, use the –p parameter to specify the printer name.

Also, if you are on Ubuntu, you may use “sudo apt-get install gnome-schedule” (Gnome Schedule) to setup a scheduled task for the script with recurrence set to “every minute.”

What the script does?

Here’s an annotated version of the script, courtesy Kurt again, that will help you easily understand how the script works:

1. #!/bin/bash

Specific bash directly since its feature set and behaviors are consistent everywhere

2. export PrintQueue

It’s necessary to ‘export’ in order for the environment variable to show up in the later $() subshell

3. IFS=$’\n’

By default, spaces will wreak havoc with the ‘for / in’ loop. Resetting the field separator handily works around that

4. /bin/ls -1

Directly use /bin/ls to bypass the common color-enabling aliases. Use -1 to force all files into one column. There’s no need to search for the beginning of the file name using this

5. lpr -r

The -r option deletes the file after it successfully prints. This is better than doing an ‘rm’ later since it only does the delete on a successful print.

Advertisements

About balajiit

BalajiIT Solutions is a leading IT company providing end-to-end IT services and solutions to Corporate and Government Clients and various other PSUs. offering entire web based services, Software Development, outsourcing and IT Consulting.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: