View previous topic :: View next topic |
Author |
Message |
audiodef Watchman
Joined: 06 Jul 2005 Posts: 6639 Location: The soundosphere
|
Posted: Fri Aug 16, 2013 3:17 pm Post subject: Init script doesn't capture pid |
|
|
I have the following init script. I need to modify it, and I'm not sure how. It is supposed to be used like net.lo - you make a symlink to it such as liquidsoap.main. The problem is, when I do that, it starts the first process and thereafter produces no error about new processes, but the new processes aren't actually started.
For example, /etc/init.d/liquidsoap.main start starts up and everything works as expected. If I then do /etc/init.d/liquidsoap.ambient start, I can see ambient.pid in /usr/local/var/run/liquidsoap, but there is no process other than liquidsoap.main found by ps aux | grep liquidsoap.
How should this script be changed to fix this?
/etc/init.d/liquidsoap:
Code: |
#!/sbin/runscript
script=${RC_SVCNAME#*.}
scriptfile="/etc/liquidsoap/${script}.liq"
command=/usr/local/bin/liquidsoap
command_args="--daemon -t ${scriptfile}"
start_stop_daemon_args="--user liquidsoap:liquidsoap --nicelevel -15 "
pidfile="/usr/local/var/run/liquidsoap/${script}.pid"
name=${RC_SVCNAME}
description="Liquidsoap deamon that obeys ${scriptfile}"
extra_commands="check"
description_check="Check and evaluate stream scripts without interupting streaming."
depend() {
need localmount
use net
after alsasound icecast
}
_script_exists() {
if [ "${script}" = "${RC_SVCNAME}" ]; then
eerror "You have to create an init script for each stream script:"
eerror "ln -s liquidsoap /etc/init.d/liquidsoap.<script>"
eerror "where script refers to /etc/liquidsoap/<script>.liq"
return 1
fi
if [ ! -f "${scriptfile}" ]; then
eerror "${scriptfile} not found"
return 1
fi
}
check() {
_script_exists || return 1
einfo "Checking ${scriptfile}"
use net
after alsasound icecast
}
_script_exists() {
if [ "${script}" = "${RC_SVCNAME}" ]; then
eerror "You have to create an init script for each stream script:"
eerror "ln -s liquidsoap /etc/init.d/liquidsoap.<script>"
eerror "where script refers to /etc/liquidsoap/<script>.liq"
return 1
fi
if [ ! -f "${scriptfile}" ]; then
eerror "${scriptfile} not found"
return 1
fi
}
check() {
_script_exists || return 1
einfo "Checking ${scriptfile}"
check_result=`$command --check-lib ${scriptfile}`
eend $? ${check_result}
return $?
}
start_pre() {
_script_exists || return 1
}
start() {
start-stop-daemon --start \
${start_stop_daemon_args} \
--pidfile ${pidfile} \
--exec ${command} \
-- ${command_args}
}
|
_________________ decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN |
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Fri Aug 16, 2013 3:42 pm Post subject: |
|
|
sounds like it crashed. _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
audiodef Watchman
Joined: 06 Jul 2005 Posts: 6639 Location: The soundosphere
|
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Fri Aug 16, 2013 4:07 pm Post subject: |
|
|
Well that init script doesn't have a stop or check, so I guess it is inheriting.
The last time I ran into something like this it was downto a script launching the actual process so its PID isn't valid for the running process.
also this should be in programming _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
audiodef Watchman
Joined: 06 Jul 2005 Posts: 6639 Location: The soundosphere
|
|
Back to top |
|
|
Naib Watchman
Joined: 21 May 2004 Posts: 6051 Location: Removed by Neddy
|
Posted: Fri Aug 16, 2013 4:33 pm Post subject: |
|
|
looking in my init.d directory it looks like they all define their own stop method:
Quote: | stop() {
ebegin "Stopping Tor"
start-stop-daemon --stop --pidfile "${PIDFILE}" --exec /usr/bin/tor -- --PidFile "${PIDFILE}"
eend $?
|
I am only postulating whether the process you are launching is the actual process that does the work. Quite a few processes have a wrapper script/program that kind of prepares environments etc. _________________
Quote: | Removed by Chiitoo |
|
|
Back to top |
|
|
audiodef Watchman
Joined: 06 Jul 2005 Posts: 6639 Location: The soundosphere
|
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10587 Location: Somewhere over Atlanta, Georgia
|
Posted: Fri Aug 16, 2013 9:31 pm Post subject: |
|
|
Moved from Off the Wall to Portage & Programming. Seems to fit better here.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters. |
|
Back to top |
|
|
|