Jeff2Ma / launchd-with-networkchange

A tool with shell script and launchd to trigger actions whenever a Mac's network information is changed.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

launchd with networkchange

A tool with shell script and launchd to trigger actions whenever a Mac's network information is changed.

[简体中文版使用说明] 请点击这里

Introduction

This repo is an easy way to deal with contexts like:

At workplace, your Mac Device has to make some settings such as change proxy address, set specical pac file, open some apps and so on. While at home your have change it again to others.

With the help of launchd, those operations can be automated. And that's what this repo do! It is fast, easy and safe.

Features

  • Easy to install and uninstall.

  • Password of your system account will be saved in keychain safely.

  • Add example so that your can easily change the code according to your conditions.

How to start

$ git clone https://github.com/Jeff2Ma/launchd-with-networkchange

$ cd launchd-with-networkchange

$ python install.py

Then input the info when is asked.

After that, please edit the code in example.sh according to your conditions.

When your Mac's network change, a notification will show when it run shell script with success.

Notices

  1. When the first run of the script, system will ask you like:

Remember to choose Always Allow.

2)you can make a example.sh copy one and rename it to dynamic.sh, it will be run instead of example.shsee how it work.

  1. If you want to uninstall it, you can run python install.py uninstall.

  2. Check /var/log/system.log if you are having issues with plist.

Contributing

Thanks to this Repo and this Alfred Workflow to provide inspiration for me.

Issues and Pull requests are warm welcome.

About

A tool with shell script and launchd to trigger actions whenever a Mac's network information is changed.

License:MIT License


Languages

Language:Python 69.2%Language:Shell 19.4%Language:AppleScript 11.4%