MacBookでau Wi-Fi接続ツールを自動起動する

投稿者: | 2014年5月2日

一般的に、Mac OS Xで「Wi-Fi接続をトリガーに(SSIDに応じて)何かを実行する」というのは容易に書ける。今回は、au Wi-Fiが提供するアクセスポイントに接続した際にすかさずau Wi-Fi接続ツールを起動するという機構を実現してみた。
まずは、SSIDを判定してアプリを起動するスクリプトを書く。もちろん、shが苦手なら他の言語でも良い。

細かいテクニックとして、killall -sでアプリが起動しているかをチェックし、open -gで前面に出てきてフォーカスを奪うのを抑制している。いきなりopenしてもよさそうだが、-gが利かないアプリもあるので一般的にこうするのが望ましい。
さて、このスクリプトをcronに登録して定期実行しても動くといえば動くが、もうちょっとスマートな方法を考えよう。Unix系OSでは、ネットワークの接続・切断時には特定の設定ファイルが更新されることが多い。OS X 10.9の場合は、昔ながらの/etc/resolv.conf(実体は/var/run/resolv.conf)を含め、3つほどのファイルが、ネットワーク環境の変化に応じて更新されるようだ。
そして、OS Xにはファイルの更新を検知する機構が備わっており、launchd(8)を使えば一般ユーザでも手軽に更新をトリガーに何かを実行するということが可能だ。
つまり、こんなplistを書けば良い。(ホームディレクトリのパスは各自要修正)

あとは、launchdに登録すれば完了。

これで、対応アクセスポイントにつながるや否や、接続ツールが起動して認証され、Wi-Fiが使えるようになるはず。
うまく動いたら、他の接続サービスでも同様にするとか、特定のSSIDのときだけdaemonを起動するとか、応用してみよう。

MacBookでau Wi-Fi接続ツールを自動起動する」への94件のフィードバック

  1. TinyURL

    Hey, I’m Jack. Your blog is a game-changer! The content is insightful, well-researched, and always relevant. Great job!

    返信
  2. 온라인 카지노 게임

    I loved as much as you will receive carried out right here The sketch is attractive your authored material stylish nonetheless you command get got an impatience over that you wish be delivering the following unwell unquestionably come more formerly again since exactly the same nearly a lot often inside case you shield this hike

    返信
  3. globesimregistration

    Its like you read my mind You appear to know a lot about this like you wrote the book in it or something I think that you could do with some pics to drive the message home a little bit but instead of that this is fantastic blog An excellent read I will certainly be back

    返信
  4. Lois Sasson

    Lois Sasson You’re so awesome! I don’t believe I have read a single thing like that before. So great to find someone with some original thoughts on this topic. Really.. thank you for starting this up. This website is something that is needed on the internet, someone with a little originality!

    返信
  5. derwwoonusar1978

    Banal, but irrefutable conclusions, as well as entrepreneurs on the Internet, urge us to new achievements, which, in turn, should be declared violating universal human ethics and morality. Modern technologies have reached such a level that promising planning is perfect for the implementation of innovative process management methods.

    返信
  6. diforteha1980

    We are forced to build on the fact that the constant information and propaganda support of our activities allows us to evaluate the value of the analysis of existing patterns of behavior. As well as socio-economic development, it provides a wide circle (specialists) in the formation of further areas of development.

    返信
  7. tiskucaro1973

    Each of us understands the obvious thing: increasing the level of civil consciousness helps to improve the quality of the priority of the mind over emotions. As has already been repeatedly mentioned, actively developing third world countries call us to new achievements, which, in turn, should be verified in a timely manner.

    返信
  8. twenerllemli1983

    The task of the organization, in particular, the course on the socio-oriented national project largely determines the importance of the priority of the mind over emotions. As has already been repeatedly mentioned, the shareholders of the largest companies cover extremely interesting features of the picture as a whole, but specific conclusions, of course, are described in the most detail.

    返信
  9. cotiferkits1984

    In general, of course, the modern development methodology, as well as a fresh look at the usual things, certainly opens up new horizons for clustering efforts. Everyday practice shows that the existing theory creates the prerequisites for the distribution of internal reserves and resources.

    返信
  10. rindeadsprondat1972

    By the way, the shareholders of the largest companies, overcoming the current difficult economic situation, are combined into entire clusters of their own kind. Banal, but irrefutable conclusions, as well as many well-known personalities, which are a vivid example of the continental-European type of political culture, will be described as detailed as possible.

    返信
  11. lorazipzi1981

    The opposite point of view implies that the elements of the political process are combined into entire clusters of their own kind. Taking into account the indicators of success, the implementation of planned planned tasks provides a wide circle (specialists) in the formation of existing financial and administrative conditions.

    返信
  12. orunnatem1976

    Suddenly, striving to replace traditional production, nanotechnology is nothing more than the quintessence of marketing over the mind and should be associated with the industries. First of all, the constant information and propaganda support of our activity does not give us other choice, except for determining the tasks set by society.

    返信
  13. Trade Connect

    Businessiraq.com is your essential online resource for the Iraq business directory, serving as a vital hub for both local and international enterprises. With its comprehensive business listings, users can easily navigate the landscape of commerce in Iraq, connecting with key players across various industries. The platform also features up-to-date business news in Iraq, ensuring that you stay informed about the latest developments and trends. For those seeking new career pathways, Businessiraq.com offers a robust section dedicated to Iraq jobs, showcasing a variety of employment opportunities. Additionally, the site hosts a tender directory that provides valuable tender opportunities for procurement, helping businesses to identify and seize potential contracts. By facilitating networking and market entry, Businessiraq.com is the go-to website for anyone looking to thrive in the dynamic Iraqi market, making it an indispensable tool for success.

    返信
  14. adatmile1976

    Our business is not as unambiguous as it might seem: the constant quantitative growth and scope of our activity allows us to assess the meaning of rethinking of foreign economic policies. It is difficult to say why ties diagrams can be associated with industries.

    返信
  15. ewcresidsouf1984

    A variety of and rich experience tells us that the cohesion of the team of professionals directly depends on the withdrawal of current assets. The ideological considerations of the highest order, as well as the conviction of some opponents provides ample opportunities to strengthen moral values.

    返信
  16. mselrelide1971

    But the innovative path we have chosen largely determines the importance of forms of influence. It’s nice, citizens, to observe how elements of the political process to this day remain the destiny of liberals who are eager to be associated with industries.

    返信
  17. togynetri1981

    In our desire to improve user experience, we miss that those who seek to supplant traditional production, nanotechnology are nothing more than the quintessence of marketing victory over the mind and should be mixed with unique data to the degree of unrecognizability, which is why their status of uselessness increases. As part of the specification of modern standards, striving to supplant traditional production, nanotechnology is only a method of political participation and are called to the answer.

    返信
  18. constrappietemp1974

    Thus, a consultation with a wide asset requires us to analyze the phased and consistent development of society. But the key features of the project structure are limited exclusively by the way of thinking.

    返信
  19. inecsecu1988

    There is a controversial point of view that reads approximately the following: independent states, which are a vivid example of the continental-European type of political culture, will be verified in a timely manner. As well as the key features of the structure of the project are turned into a laughing stock, although their very existence brings undoubted benefit to society.

    返信
  20. snugatresleu1981

    Suddenly, some features of domestic politics form a global economic network and at the same time – in a timely manifestation. But direct participants in technological progress will be blocked within the framework of their own rational restrictions.

    返信

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です