Tuesday, March 19, 2013

Automate easily your tasks on Ubuntu with Cuttlefish

http://linuxaria.com/recensioni/automate-easily-your-tasks-on-ubuntu-with-cuttlefish?lang=en


Cuttlefish is a tool which can execute various actions when specific events are triggered, and it allows you to create events that only happen under certain circumstances
For example, you could set a condition/reaction such as “when the lan network is connected start Transmission”, or “Unmute the audio when I start Banshee and mute it when I close Banshee”.
The nice things of this program is that it’s completely configurable via a nice graphical interface that makes the creation of any task extremely easy and intuitive.
The software is wrote in python, open source and is born on Ubuntu as “Ubuntu app” and so it’s easily installable on this distribution or Derivate, there is a package from AUR for Arch Linux and I’m sure soon you’ll find it for any distribution.



Cuttlefish is very powerful in what it can do, you can do things like opening your browser when Ubuntu connects to your wireless LAN, or automatically lock your screen when a USB stick is unplugged (this is a great idea for computers in public places like in work), the basic concept are really simple, you create a basic condition (known as stimulus) that once met will trigger another action (known as reflexes)
These are the conditions (Stimulus) that are supported:
  • Startup / shutdown application
  • Connect / disconnect Bluetooth device (you can choose)
  • On / off Bluetooth
  • Connection / disconnection of the wireless network (you can choose which one)
  • The power cord is connected / disconnected
  • The screensaver is activated / deactivated
  • A USB device is connected / disconnected (you can also choose the device)
Once one of these conditions is met, whichever of them you have set, you can make do one of the following actions (Reflexes):
  • Startup / shutdown of an application (you can also set the advanced parameters, with additional scripts, setting details, working directory, etc.).
  • Set the volume
  • Activate / deactivate Bluetooth
  • Changing the default printer
  • Change the background
  • Changing the proxy mode
  • waiting
  • Change the status of Pidgin
  • Hibernate, reboot, power off, suspend
  • To enable / disable WLAN
  • Activating / deactivating the screensaver (screen lock)
Let’s see a basic example, start Firefox when WLAN is connected:
cuttlefish01
Open Cuttlefish and click on New.
Give it a name, and change Activated by stimulus option to ON.
cuttlefish02
Click on Stimulus, select the category Network and type Connect to WLAN. Click OK.
cuttlefish03
You can also select the SSID of wireless network and you have an option of whether or not to check this on startup.
cuttlefish04
Now you will have to specify a reaction. Go to Reaction tab, and click add. Select Applications from the category and Start Application(in advanced mode) from type.
cuttlefish05
Now specify the script which you want to run in executable option. You can even pass parameters to the script.
cuttlefish06
And that’s it! Also make sure that you add Cuttlefish in startup applications. Go to Edit > Preferences and enable the autostart option.

Conclusions

If the tasks scheduled through cron or incron are not enough for you, Cuttlefish can be of help and allows easy programming of actions/reactions that would otherwise be very difficult to express in another manner.
Reference:
how to run a script every time internet connects

No comments:

Post a Comment