Tiny Core Linux

General TC => General TC Talk => Topic started by: angryjack on September 04, 2015, 10:25:09 AM

Title: Starting Lighttpd with bootlocal.sh
Post by: angryjack on September 04, 2015, 10:25:09 AM
Hello,

i have a problem loading lighttpd with bootlocal.sh. I did add the following line but the server won't start at boot:

Code: [Select]
sudo lighttpd -m /usr/local/lib/lighttpd -f /home/tc/lighttpd.conf
If i do execute the line manually the server does start. What can i do ?
Title: Re: Starting Lighttpd with bootlocal.sh
Post by: Rich on September 04, 2015, 10:30:30 AM
Hi angryjack
I'm guessing your network card isn't up yet. Are you running a GUI?
Title: Re: Starting Lighttpd with bootlocal.sh
Post by: curaga on September 04, 2015, 10:33:36 AM
Also, don't use sudo, bootlocal.sh runs as root.
Title: Re: Starting Lighttpd with bootlocal.sh
Post by: Rich on September 04, 2015, 10:59:38 AM
Hi angryjack
If you are running a GUI, the simplest fix is to create a file in the  .X.d  directory containing:
Code: [Select]
sudo lighttpd -m /usr/local/lib/lighttpd -f /home/tc/lighttpd.conf &It will be run automatically once X is up.
If you are not running a GUI, place the following in bootlocal.sh:
Code: [Select]
SEC=60
while [ $SEC -gt 0 ] ; do
   ifconfig | grep "inet addr:" | grep -qv "127.0.0.1" && break
   sleep 1
done
lighttpd -m /usr/local/lib/lighttpd -f /home/tc/lighttpd.conf
Title: Re: Starting Lighttpd with bootlocal.sh
Post by: angryjack on September 04, 2015, 03:36:36 PM
I do run PiCore on a RPi2 without GUI. Will try the script on monday. Thank you!
Title: [Solved] Starting Lighttpd with bootlocal.sh
Post by: angryjack on September 07, 2015, 03:36:12 AM
Hello,

with the script it did also not work but it is running now.

The reason why it was not working was that i tried to start Lighttpd after Inetd. I placed the line before inetd and now it runs  ;)

Here is my bootlocal.sh
Code: [Select]
#!/bin/sh

# Start serial terminal
/usr/sbin/startserialtty &

# Set CPU frequency governor to ondemand (default is performance)
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

# Load modules
/sbin/modprobe i2c-dev

# Start openssh daemon
/usr/local/etc/init.d/openssh start

# Start Webserver
lighttpd -m /usr/local/lib/lighttpd -f /home/tc/lighttpd.conf

# Start Inetd
/usr/local/sbin/inetd -d /etc/inetd.conf



# ------ Put other system startup commands below this line
Title: Re: Starting Lighttpd with bootlocal.sh
Post by: gerald_clark on September 07, 2015, 11:46:27 AM
lighttpd has a startup script in /usr/local/etc/init.d.  Why are you not using it?