I'm not thinking about pure scheduled tasks, but rather things where a daemon in the background will automatically trigger a script when certain conditions are met.

For those who have used Tasker on Android, you probably have an idea of what I'm talking about already. For those who don't, this would include things like:

  • automatically triggering scripts when a Macbook is plugged in or unplugged; or
  • having the computer automatically go into sleep mode when it gets a certain message (via an open port, or email, or whatever), and similarly wake up again; or
  • automatically opening a connection to a file server on the same network at a certain time of day; and so on.

I've seen assorted software tools to do this kind of thing piecemeal, but I'd be extremely curious in finding any mostly-integrated way, premade or homebrew, to accomplish the same kind of flexibility in automation that I've gotten used to on my phone.

I also figure this question will be most helpful if applied across the range of OSes rather than more limited.

  • 2
    Please explain what you expect in an accepted answer. Do you need the same person to know the internals of all major operating systems? How much scripting, configuration, and file editing are you willing to do to accomplish this? What kinds of operations do you want to trigger using what criteria? – Daniel Beck Oct 30 '11 at 12:32

I'm not thinking about pure scheduled tasks

Actually, I think you are thinking of Scheduled Tasks, as least in Windows. In Windows 7, you can set up scheduled tasks that start based on certain events. I know at least 1 and 3 from your list, and possibly also #2 depending on the app that's listening.

The screen shot below shows the available trigger options. The big one here is the "On an event" option, as Windows writes a huge amount of information to the event log. It's just a matter of tracking an example down in the event viewer.

Task Trigger

An example for "Resume from sleep", choose the System event log, the Power-Troubleshooter source, and Event ID 1. The "custom" option allows you to also filter on the data in the event.

  • Huh! I wasn't aware of that one, having not used 7 much myself. Is there a list anywhere of the triggers that it can use? – Roadie Oct 30 '11 at 4:12
  • @Roadie - updated my answer. – Joel Coehoorn Oct 30 '11 at 4:16

A Mac solution that I discovered myself recently is ControlPlane.

A very useful application developed as a fork of the MarcoPolo project. MarcoPolo brings context-aware computing to your portable Mac computer.

It allows your computer to determine its context through gathering evidence from your environment (evidence sources), using flexible rule-based fuzzy matching to make an educated guess (rules), and then performing arbitrary actions upon changing context (actions).

The concept of contexts is a generalisation of a location, and encompasses more than just where your computer is. A context might represent what you are doing, or what else is going on around you.

It quietly stays in the status bar at the top of your screen (right-hand side of the menu bar), from where it can be configured to your own needs.


For Linux you can use Udev events and/or Systemd services. There is plenty information how to set it up over internet. I would recommend to start with Arch wiki (Systemd, Udev) independent of your distribution flavor

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.