Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I use Fedora 13 and am trying to create a service for darkice. I put the script in the /etc/init.d directory and if I use the command service darkice start, the darkice is running in the foreground and the command prompt is not returned.

How do I make darkice run in the background?

The following is the excerpt from the darkice script.

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/local/bin/darkice
NAME=darkice
DESC="Darkice live audio streamer"

test -x $DAEMON || exit 0
CONFIGFILE="/etc/darkice.cfg"

# Source function library.
. /etc/rc.d/init.d/functions


# See how we were called.
case "$1" in
  start)
    # Start daemon.
    echo -n $"Starting darkice streaming daemon: "
    daemon "$DAEMON -c $CONFIGFILE > /dev/null"
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/darkice
    ;;
  stop)
share|improve this question
    
Just for the record Fedora 13 is end of life and you should upgrade to a currently supported distribution - fedoraproject.org/wiki/End_of_life –  Ulrich Dangel Jun 11 '12 at 21:05
    
I know that. I tried once to upgrade to f14 using system->Administration->software update ->Upgrade. But somehow it did not go thru all the way and failed. Do you know of a good way that upgrades to the next distribution? Thank you. –  Jkmin Jun 11 '12 at 21:39
add comment

1 Answer 1

In man darkice there is no information about running darkice in background (daemon mode), but I found site where init script is provided.

Darkice is started in screen with -d switch that instantly detach screen. Whole command to run it looks like this:

DARKCONFIG="/home/drmoreau/darkice/darkice.cfg"
DARKBIN="darkice"
DARKCMD="$DARKBIN -c $DARKCONFIG"
DARKUSER="PUT YOUR LOCAL USERNAME HERE IN LOWERCASE"
SCREENEXE="screen"
SCREENOPTS="-d -m -S darkice_stream"
su "$DARKUSER" -c "$SCREENEXE"" $SCREENOPTS"" $DARKCMD"
share|improve this answer
    
Thank you for the prompt reply. Could you explain why the daemon function command does not work in the first place? Thank you very much for the link for the init script. I could not find the link you mention. I will work on the init script and implement on my f13 to see if it works. Thank you again. –  Jkmin Jun 11 '12 at 21:34
    
I'm not sure how function daemon() is built in Fedora 13, but from I found in Internet there is no code that could put process in background (detach from terminal). It is only doing few checks and start application. –  pbm Jun 12 '12 at 17:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.