Way to automatically run scripts based on conditions on PC/Mac/Linux, like Tasker for Android

automation

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.

Best Answer

  • 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.

  • Related Question