|
|
Ten different ways to connect to servers
Very useful. There is yet another way: run scripts with launchd.
Our music is stored on a server and I wanted to do the following things:
Save in ~/Library/LaunchAgents if specific to a user or /Library/LaunchAgents to run for all users. This 'agent' runs when someone logs in and when the /Users/barry/Music/iTunes Library Extras.itdb is modified - which generally only happens when iTunes starts up. It doesn't seem possible to monitor the main iTunes Library database, perhaps because of its lack of filename. The agent expects to run a shell script /Users/Shared/ConnectToNASlaunchd.sh; this will actually do the connecting and will be written later. One further launchd agent can be created to run every few minutes. In the example below, it runs a script called /Users/Shared/ConnectToNASifITunesRunning.sh every 60 seconds:
Now, to create the scripts. ConnectToNASlaunchd.sh does the connecting to the server. In this example, it actually mounts two sharepoints with SMB. It also contains commands for AFP connections, commented out.
The final script is the one that runs every few minutes, ConnectToNASifITunesRunning.sh. It checks to see if iTunes is running, and if so runs the other connect script. If iTunes is not running it does nothing, meaning that the server doesn't get woken up from sleep unnecessarily.
I made these scripts accessible only to root with NB In addition, I made the ~/Music/iTunes Media/Music folder an alias to the actual location of the music and locked it. iTunes has an annoying habit of defaulting back to this location if the proper location isn’t available. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:Hints1 new Hints in the last 24 hoursComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.09 seconds |
|