Dropbox, is a multiplatform tool that allows you to sync and share files online across computers. If you save a file in your home computer, when you turn on your computer at work, for example, that file will be automatically synced if you have Dropbox installed. It also have a web interface, so you don't even need to install it.
If you don't know it, definitely check it out.
Control your machine with Dropbox
What I will show, is a way to control your home computer from, for example, your workplace, using Dropbox.
Here's two scenarios:
- You need a document you have at home, but it is not in your Dropbox share
- You want to download the latest Ubuntu torrent so when you get home the download is finished
Both this scenarios have the same solution: use a combination of Dropbox, crontab, shell scripts and a config file.
First of all you need of course Dropbox. Even without this post it is extremely cool and useful :)
In this example the Dropbox location is /home/user/Dropbox/.
Create a shell script in your favorite location. In this example it will be /home/user/.
$ touch /home/user/dropscript.sh
$ chmod 755 /home/user/dropscript.sh
For now I'll do a simple example, but I'll post some improvements at a later time.
Add the following to the script:
In your Dropbox location create a configuration file. This is the file you will be editing from your workplace in order to get things done.
I want this to be a more structured file, but for now I'll show a simple example.
$ touch /home/user/Dropbox/dropconfig
Add the following to the file, accordingly to the scenario:
cp /home/user/Documents/myfile /home/user/Dropbox/
Have crontab run your script. In this example every minute.
$ crontab -e
Add the following to crontab:
* * * * * '/home/user/dropscript.sh'
The showed example will execute the instructions in your configuration file every minute of every day. If you are at work and you need a file or want to shutdown your machine, just edit the configuration file available at your Dropbox, and wait until crontab executes your command. It's that simple.
Of course there are many solutions to scenarios like this. Better and more elegant, sure. Still, I think this is a pretty cool solution.
- Free solution
- No variable IP troubles
- Security - you could do virtually everything that can be executed in a Terminal
Comment await and share the things you are doing using Dropbox :-)