Results 1 to 2 of 2

Thread: Running Shairport (or arbitrary audio service) as a Daemon

Hybrid View

  1. #1
    Join Date
    Jul 2006
    Beans
    Hidden!

    Running Shairport (or arbitrary audio service) as a Daemon

    Hey guys,

    While I wouldn't consider myself a complete Linux newb, I'm at a bit of a loss here.

    I'm trying to get Shairport, a Perl script that acts as an AirPlay speaker, to run as a "daemon" on my Ubuntu machine.

    Originally, I had Shairport setup to run whenever I logged in through the "Startup Applications" system panel -- but I'd like the script to run in the background without requiring a user to be logged in.

    Obviously, I can't run Shairport until Ubuntu has finished setting up all the audio and network (including avahi) requirements. I took a look at Upstart, and while I understand the event driven model, I'm not sure what I want to execute Shairport after or before. In Narwhal, I see a few things that might be relevant, including: alsa-restore, alsa-store, and avahi-daemon.

    I'm also a little confused about how Ubuntu handles audio in general -- I know PulseAudio is the standard, but there appears to be some "hold overs" of ALSA stuff, or perhaps ALSA is just functioning as a plugin to Pulse. Either way, since I can't run Shairport with my own user account (as I don't want to have to login), is there any "gotchas" I should be aware of in terms of other users accessing audio-out?

    TL;DR: How do I run an audio and network enabled Perl script as a daemon without requiring a login?

    Thanks,

    Ryan Marcus

  2. #2
    Join Date
    Jun 2009
    Beans
    13

    Re: Running Shairport (or arbitrary audio service) as a Daemon

    found how to do this under an xbmc thread somewhere.

    for simplicity, download shairport, compile it, and move the folder to ~/yourusername/.shairport

    Code:
    cd ~/yourusername/.shairport/
    sudo nano shairport.pl
    Find the line (52) where it starts with “my $hairtunes_cli =” change the path to the hairtunes file in the shairport folder

    Code:
    sudo cp shairport.init.sample /etc/init.d/shairport
    sudo nano /etc/init.d/shairport
    Find the line (20) where it starts with “DAEMON =” change the path to the shairport.pl file in the shairport folder

    Code:
    sudo chmod +x /etc/init.d/shairport
    sudo update-rc.d shairport defaults
    sudo service shairport start
    Test, then reboot and test!

    i literally just stumbled on this now and knew there was a thread here with no response that ive stumbled on many times looking for an answer myself!

    after re-reading your thread i cant comment on the login issue though... but this will certainly run it as a service.
    Last edited by iLLNiSS; April 27th, 2012 at 11:02 PM.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •