Hi, Joao,
> But... just for curiosity, what does this script intends to control?
> what is 'pyload'?
pyLoad is a lightweight download manager for many One-Click-Hosters,
video sites, or plain http/ftp links.
> if you look to other scripts...
> from Alt-F, you will notice that the function start is invoked with
> $NAME as argument, where NAME is a variable defined at the top and has
> the name of the process you want to execute)
Thanks for looking at the scripts,
Somehow they got mixed together, which did'nt help.
I've looked at the your other scripts and used the name function, and
this is what I've come up with...
Unfortunately the "start" from the webgui just does'nt work, however
it does from the command line, which is weird.
Both the "status" and "stop" work now.
I changed some of the functions names to avoid confusion.
/mnt/sda2/debian/debian/etc/init.d/pyload
##################################################################################################################################
#!/bin/sh
PYLOAD_DIR="/opt/pyload" # folder which contains pyLoadCore.py
PYTHON="/usr/bin/python"
LOG="/var/log/pyload.log"
PIDFILE="/root/.pyload/pyload.pid"
go() {
echo "Starting Service: pyload"
start-stop-daemon --start --oknodo --pidfile ${PIDFILE} -b -d $
{PYLOAD_DIR} --startas ${PYTHON} pyLoadCore.py -- >>${LOG} 2>>${LOG}
}
end() {
echo "Stopping Service: pyload"
start-stop-daemon --stop --oknodo --pidfile ${PIDFILE} --retry=TERM/
30/KILL/5
rm ${PIDFILE}
}
test() {
echo -n "Status of pyload: "
if [ -e ${PIDFILE} ]; then
echo " Pyload daemon is running"
return 0
else
echo " Pyload daemon is not running"
return 1
fi
}
case "$1" in
go)
go
;;
end)
end
;;
test)
test
;;
esac
###################################################################################################################################
and the wrapper script
/etc/init.d/S90pyload
####################################################################################################################################
DESC="Daemon to run pyload"
NAME=pyload
TYPE=sys
. $(dirname $0)/common
case "$1" in
start) $NAME go ;;
stop) $NAME end ;;
status) $NAME test ;;
*) usage $0 "start|stop|status" ;;
esac
####################################################################################################################################
Any thoughts as to why the "start" does'nt work...? (is it because, it
needs to be run from a chroot?)
Thanks