Old 24th November 2014, 08:33   #1
ShanghaiTimes
Junior Member
 
ShanghaiTimes's Avatar
 
Join Date: Nov 2014
Location: Suffolk, UK
Posts: 48
OSX. How to start Shoutcast DNAS automatically

Just sharing something useful I put together for OS X. I wanted to be able to start Shoutcast DNAS anytime the system had to reboot. Not often on OS X fortunately, but as I do a lot of development on this system it does become necessary from time to time. IN addition, Yosemite is actually still updating - so restarts are more common that I would like.

ok. It's all controlled by Launchd. You can find lot of tutorials about it out there, as well as the man pages. here's the simple instruction to get sc_serv started.

You will need to be comfortable using Terminal and vi, or a similar editor. However, you may be able to do the edits using TextEditor and Finder to get to the directories. I just use Terminal and vi. too easy.

You probably should be running sc_serv as a User. NOT as the System or Root. (very bad) which makes this easy. You have a directory called
/Users/your-user-name/Library/LaunchAgents

Go find it with Finder, you may need to type it into the search bar... Or simply open a Terminal from Utilities, and type
cd /Users/your-user-name/Library/LaunchAgents or, more simply
cd ~/Library/LaunchAgents

Type pwd. That will show you if you are in the correct directory.
Just remember, when you write your plist file, you need the full path.

... don't go to /Library/LaunchAgents .... that's something else Entirely

Now, I don't know where you have sc_serv installed, but I put mine in
/Users/robert/ShoutcastDNAS

But, wherever you did put it, you need that directory path.

Now, this is the launchd plist file. Create a file in your /Users/your-user-name/Library/LaunchAgents folder, and call it org.shoutcast.plist
It's kind of a naming convention, so when you see it next year, you know exactly what it does.

You should also note that in that file I have ALL the directory/folder paths. You need this, so the system won't lose it's way when trying to start the programs, and find the configuration files.


code:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.shoutcast.plist</string>
<key>ProgramArguments</key>
<array>
<string>/Users/robert/ShoutcastDNAS/sc_serv</string>
<string>/Users/robert/ShoutcastDNAS/sc_serv.conf</string>
</array>
<key>KeepAlive</key>
<true/>
</dict>
</plist>



Make sure sc_serv isn't already running .... I am assuming you know how to stop it with 'kill'.

now,

Save the file - make sure you saved it in that /Users/your-user-name/Library/LaunchAgents folder, and then - from the command line, (you really do need to be in Terminal for this) type.

launchctl load -w ~/Library/LaunchAgents/org.shoutcast.plist

and sc_serv will be running again.

You don't need to be root, or use sudo, if you are running shoutcast as yourself.

The -w tells the system to store this and load it again automatically when the system restarts at some point.


enjoy.

~~~~~~
Robert Chalmers
@ShanghaiTimes
OSX Yosemite. on.
Model Name: Mac mini
Model Identifier: Macmini6,2
Processor Name: Intel Core i7
Processor Speed: 2.3 GHz
Number of Processors: 1
Total Number of Cores: 4
L2 Cache (per Core):256 KB
L3 Cache:6 MB
Memory:16 GB
Boot ROM Version:MM61.0106.B03
SMC Version (system):2.8f1
ShanghaiTimes is offline   Reply With Quote
Old 8th February 2015, 07:39   #2
dopelabs
Major Dude
 
dopelabs's Avatar
 
Join Date: Oct 2006
Location: Silicon Valley
Posts: 526
Send a message via AIM to dopelabs
or open terminal and type

echo "@reboot /Users/robert/ShoutcastDNAS/sc_serv /Users/robert/ShoutcastDNAS/sc_serv.conf" | crontab
dopelabs is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > SHOUTcast > SHOUTcast Discussions

Tags
autostart, mac, osx, plist, yosemite

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump