WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: what to do if no /etc/init.d script shipped into the source code  (Read 2568 times)

Offline halma

  • Full Member
  • ***
  • Posts: 164
what to do if no /etc/init.d script shipped into the source code
« on: December 20, 2015, 09:54:53 AM »
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
1 + 2 = 6  cause  10 - 6 = 78 ;-) lol

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: what to do if no /etc/init.d script shipped into the source code
« Reply #1 on: December 20, 2015, 10:18:05 AM »
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.
« Last Edit: December 20, 2015, 10:20:49 AM by gerald_clark »

Offline halma

  • Full Member
  • ***
  • Posts: 164
Re: what to do if no /etc/init.d script shipped into the source code
« Reply #2 on: December 20, 2015, 12:06:25 PM »
sorry my fault, forgot to say i use x64 TC, but its not avaible under "x64" with tce-ab
1 + 2 = 6  cause  10 - 6 = 78 ;-) lol

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11639
Re: what to do if no /etc/init.d script shipped into the source code
« Reply #3 on: December 20, 2015, 12:27:30 PM »
Hi halma
Here is the script from the 32 bit extension:
Code: [Select]
#!/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

Offline halma

  • Full Member
  • ***
  • Posts: 164
Re: what to do if no /etc/init.d script shipped into the source code
« Reply #4 on: December 21, 2015, 11:25:05 AM »
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
1 + 2 = 6  cause  10 - 6 = 78 ;-) lol