shell - SHOUTcast daemon script not functioning properly -


i've got shoutcast server running on ubuntu. server process running great, can't seem daemon script function properly. following couple tutorials found came this:

#!/bin/sh  config="/home/apps/shout32/sc_plex.conf" daemon="/home/apps/shout32/sc_serv"  case "$1" in     start)         echo "starting sc..."         $daemon $config > /dev/null 2>&1 &         ;;     stop)         echo "stopping sc..."         kill -9 `ps -c sc_serv -o pid --no-headers`         ;;     restart)         echo "rebooting sc..."         kill -9 `ps -c sc_serv -o pid --no-headers`         $daemon $config > /dev/null 2>&1 &         ;;     *)         echo "usage: service sc32d {start | stop | restart}"         exit 1         ;; esac 

this not work. didn't know lot of meant, started break down line line. if remove /dev/null stuff - understand keeps program running 'silent' in background - message, , program closes:

root@streams3:/etc/init.d# service sc32d start starting sc... root@streams3:/etc/init.d# 2013-05-21 14:41:50  e       msg:<***>       logger not open file logs/sc_serv.log 2013-05-21 14:41:50           msg:<***>       logger shutdown  root@streams3:/etc/init.d# root@streams3:/etc/init.d# ps -c sc_serv   pid tty          time cmd root@streams3:/etc/init.d# 

i still in process of researching /dev/null did , why, wanted run commands /dev/null stuff hand, did, , that's got sort of error code:

root@streams3:/etc/init.d# /home/apps/shout32/sc_serv /home/apps/shout32/sc_plex.conf > /dev/null 2>&1 & [2] 2261 root@streams3:/etc/init.d# [2]-  exit 255                /home/apps/shout32/sc_serv /home/apps/shout32/sc_plex.conf > /dev/null 2>&1 root@streams3:/etc/init.d# ps -c sc_serv   pid tty          time cmd 

unfortunately brief amount of research did sounds 'exit 225' catch-all error code codes outside of acceptable range of codes.

the interesting part of whole issue this: when navigate /home/apps/shout32/ folder, , run commands there, without full path... damn thing works:

root@streams3:/home/apps/shout32# ./sc_serv sc_plex.conf > /dev/null 2>&1 & [2] 2245 root@streams3:/home/apps/shout32# root@streams3:/home/apps/shout32# ps -c sc_serv   pid tty          time cmd  2245 pts/0    00:00:00 sc_serv 

so, messing because script file in /etc/init.d/ , not in folder application in? far know followed every step in published tutorials setting shoutcast in ubuntu , making daemon... don't think missed anything. have feeling solution either staring me right in face or sort of obscure permissions thing that's bit on head.

but appreciated!


so, based on answer below added cd /home/apps/shout32/ start command in script, added pwd , ls... see if eliminate fact script couldn't find /log/ directory.

so script is:

config="/home/apps/shout32/sc_plex.conf" daemon="/home/apps/shout32/sc_serv"  cd /home/apps/shout32/  case "$1" in         start)                 echo "starting sc..."                 cd /home/apps/shout32/                 pwd                 ls                 $daemon $config &                 ;;         stop)                 echo "stopping sc..."                 kill -9 `ps -c sc_serv -o pid --no-headers`                 ;;         restart)                 echo "rebooting sc..."                 kill -9 `ps -c sc_serv -o pid --no-headers`                 $daemon $config &                 ;;         *)                 echo "usage: service sc32d {start | stop | restart}"                 exit 1                 ;; esac 

i got this:

admin@streams3:/etc/init.d$ service sc32d start starting sc... /home/apps/shout32 changes.txt     readme.txt                     sc_serv_debug.conf config_builder  sc_plex.conf                   sc_serv_public.conf control         sc_serv                        sc_serv_relay.conf docs            sc_serv2_linux_07_31_2011.tar  sc_serv_simple.conf logs            sc_serv_basic.conf             tos.txt admin@streams3:/etc/init.d$ 2013-06-05 17:52:08      e       msg:<***>      logger not open file logs/sc_serv.log 2013-06-05 17:52:08           msg:<***>       logger shutdown 

your second snippet contains logger not open file logs/sc_serv.log. tries write file sc_serv.log either expects or wants create in directory logs expects in current directory. explains works when cd /home/apps/shout32/ first. guess there's file /home/apps/shout32/logs/sc_serv.log.

can configure location of file? can't add cd ... @ start of script?


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -