Tiny Core Extensions > TCE Talk
what to do if no /etc/init.d script shipped into the source code
(1/1)
halma:
Hi,
what can i do if there is no "/etc/init.d/extension/script",(/usr/local/etc/init.d/extension/scipt), shipped into the sourcecode of a programm, like lighttpd ... is there any template for tinycorelinux or so?
Thanks
gerald_clark:
lighttpd is already in the repo, and has an init.d script.
Not every service needs an init.d script.
Just start the program in /opt/bootlocal.sh.
halma:
sorry my fault, forgot to say i use x64 TC, but its not avaible under "x64" with tce-ab
Rich:
Hi halma
Here is the script from the 32 bit extension:
--- Code: ---#!/bin/sh
#
# lighttp Startup script for the lighttpd server
#
# Important: pidfile is assumed to be created
# by lighttpd (config: server.pid-file).
# Don't change this !
LIGHTTPD_CONF_PATH="/usr/local/etc/lighttpd/lighttpd.conf"
LIGHTTPD_MODULE_PATH="/usr/local/lib/lighttpd"
prog="lighttpd"
lighttpd="/usr/local/sbin/lighttpd"
pidfile="/var/run/$prog.pid"
RETVAL=0
status() {
if [ -e $pidfile ]; then
echo "$prog is running."
RETVAL=0
else
echo "$prog is not running."
RETVAL=1
fi
return $RETVAL
}
start() {
if [ -e $pidfile ]; then
echo "$prog is running."
RETVAL=1
else
echo -n "Starting $prog: "
$lighttpd -f $LIGHTTPD_CONF_PATH -m $LIGHTTPD_MODULE_PATH
RETVAL=$?
[ $RETVAL -eq 0 ] && echo "OK" || echo "ERROR"
fi
return $RETVAL
}
stop() {
if [ -e $pidfile ]; then
echo -n "Stopping $prog: "
killall $prog > /dev/null 2>/dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
rm -f $pidfile
echo "OK"
else
echo "ERROR"
fi
else
echo "$prog is not running."
RETVAL=1
fi
return $RETVAL
}
reload() {
if [ -e $pidfile ]; then
echo -n "Reloading $prog: "
pkill -HUP $prog
RETVAL=$?
[ $RETVAL -eq 0 ] && echo "OK" || echo "ERROR"
else
echo "$prog is not running."
RETVAL=1
fi
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f $pidfile ]; then
stop
sleep 2
start
fi
;;
reload)
reload
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|reload|status}"
RETVAL=1
esac
exit $RETVAL
--- End code ---
halma:
thanks a lot all so far, @rich the script himself, i allready saw into the lighttpd 32bit tcz extension, but the original source does not provide a init TC compatible init script, from the source..., i think the most important part of the question is, does TC provide a template like init script, and another part of the question is,, if TC does not provide a template like, what i can do ... if i am right, TC is based on busybox , may i will take a look into this direction for a init template, or i better call it "skeleton" like ... idk .. the init script from the 32bit tcz, just only coping is not the way to learn :D, i mean, different systems, different "start/init" scripts
thanks
Navigation
[0] Message Index
Go to full version