Active Topics

 


Reply
Thread Tools
Posts: 200 | Thanked: 300 times | Joined on Nov 2009 @ The Netherlands
#1
Hi,

I have lighttpd installed on my n900 and works great but I have to manualy start the server (/etc/init.d/lighttpd start).

How can I make lighttpd run at boot of the device?

I'm not known to implement this.... (bit of a linux noob but eager to learn )
 

The Following User Says Thank You to digitalvoid For This Useful Post:
cddiede's Avatar
Posts: 1,034 | Thanked: 784 times | Joined on Dec 2007 @ Annapolis, MD
#2
The N900 uses upstart instead of init. Check this thread for details: http://talk.maemo.org/showthread.php?t=35567
 

The Following 2 Users Say Thank You to cddiede For This Useful Post:
Posts: 65 | Thanked: 21 times | Joined on Feb 2008
#3
Thanks for the help. I've been trying to get this to work throught the init process for days.

As root, I have put the following bare-bones script in /etc/event.d/

Code:
description "lighttpd - a lightweight web server"

start on stopped rcS
stop on starting shutdown

console output

exec /usr/sbin/lighttpd -f /etc/lighttpd.conf
respawn
I rebooted, and (happy day) lighttpd was running. Cheers, all.
__________________
Just another perl hacker coding python in a bottle.
 

The Following 2 Users Say Thank You to dvergin For This Useful Post:
Posts: 200 | Thanked: 300 times | Joined on Nov 2009 @ The Netherlands
#4
It doesn't work for me:

/etc/event.d/lighttpd

Code:
description "lighttpd - a lightweight web server"

start on stopped rcS
stop on starting shutdown

console output

exec /usr/sbin/lighttpd -f /etc/lighttpd.conf
respawn
and in /etc/init.d

Code:
#! /bin/sh
#
# skeleton	example file to build /etc/init.d/ scripts.
#		This file should be used to construct scripts for /etc/init.d.
#
#		Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#		Modified for Debian 
#		by Ian Murdock <imurdock@gnu.ai.mit.edu>.
#
# Version:	@(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl
#

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/lighttpd
NAME=lighttpd
DESC=lighttpd
DAEMON_OPTS=-f\ /etc/lighttpd.conf

test -x $DAEMON || exit 0

# Include lighttpd defaults if available
if [ -f /etc/default/lighttpd ] ; then
	. /etc/default/lighttpd
fi

set -e

case "$1" in
  start)
	echo -n "Starting $DESC: "
	start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
		--exec $DAEMON -- $DAEMON_OPTS
	echo "$NAME."
	;;
  stop)
	echo -n "Stopping $DESC: "
	start-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \
		--exec $DAEMON
	echo "$NAME."
	;;
  #reload)
	#
	#	If the daemon can reload its config files on the fly
	#	for example by sending it SIGHUP, do it here.
	#
	#	If the daemon responds to changes in its config file
	#	directly anyway, make this a do-nothing entry.
	#
	# echo "Reloading $DESC configuration files."
	# start-stop-daemon --stop --signal 1 --quiet --pidfile \
	#	 /var/run/$NAME.pid --exec $DAEMON
  #;;
  force-reload)
	#
	#	If the "reload" option is implemented, move the "force-reload"
	#	option to the "reload" entry above. If not, "force-reload" is
	#	just the same as "restart" except that it does nothing if the
	#   daemon isn't already running.
	# check wether $DAEMON is running. If so, restart
	start-stop-daemon --stop --test --quiet --pidfile \
		/var/run/$NAME.pid --exec $DAEMON \
	&& $0 restart \
	|| exit 0
	;;
  restart)
       echo -n "Restarting $DESC: "
	start-stop-daemon --stop --quiet --pidfile \
		/var/run/$NAME.pid --exec $DAEMON
	sleep 1
	start-stop-daemon --start --quiet --pidfile \
		/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
	echo "$NAME."
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
	echo "Usage: $N {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
I can start it manually with:

Code:
/etc/init.d/lighttpd start
or with:

Code:
start lighttpd
Maybe something simple but I can't see it...

Last edited by digitalvoid; 2010-01-18 at 20:48. Reason: adding more info
 
Posts: 65 | Thanked: 21 times | Joined on Feb 2008
#5
Originally Posted by digitalvoid View Post
It doesn't work for me:
...Maybe something simple but I can't see it...
Drat! Hmmm... At first glance you and I appear to have done the same thing with different results. Grasping at straws here, but here's a quick dump of the thoughts that occur to me. I apologize if you've already checked all of these.

What exactly do you mean by "it doesn't work"?
- Pages don't load from localhost?
- 'ps' command doesn't show lighttpd?
- Other?

Have you performed the recent "major" OS upgrade? If I go to Settings->About_Product, I see: Version: 2.2009.51-1.002

What is the output from:

Code:
ls -l /etc/event.d/lighttpd
Does the output line begin with:

Code:
-rw-r--r--    1 root     root
After a reboot, what is the result of:

Code:
ps | grep lighttpd
Does something like this show up?

Code:
687 root      2492 S    /usr/sbin/lighttpd -f /etc/lighttpd.conf
How exactly did you put /etc/event.d/lighttpd on your N900? Did you type it in by hand or copy/paste from my post above? Did you perhaps create it on a windows machine and move it to the N900?

Sorry. That's not much help. But at least let's document a little more painstakingly what you have done right in order to narrow down where the problem may lie. Maybe if we have a sufficiently detailed report, someone else can suggest something.
__________________
Just another perl hacker coding python in a bottle.

Last edited by dvergin; 2010-01-18 at 23:06.
 

The Following User Says Thank You to dvergin For This Useful Post:
Posts: 200 | Thanked: 300 times | Joined on Nov 2009 @ The Netherlands
#6
What is the output from:

Code:
ls -l /etc/event.d/lighttpd
Does the output line begin with:

Code:
-rw-r--r--    1 root     root
YES

After a reboot, what is the result of:

Code:
ps | grep lighttpd
Does something like this show up?

Code:
687 root      2492 S    /usr/sbin/lighttpd -f /etc/lighttpd.conf
NO, lighttpd is not running.


It will however after I manually do:

Code:
start lighttpd
or

Code:
/etc/init.d/lighttpd start
or

Code:
/usr/sbin/lighttpd -f /etc/lighttpd.conf

I did copy/past it with WinSCP to my device and using the lasted firmware (51-1).


Any thoughts about this?

Last edited by digitalvoid; 2010-01-18 at 23:26.
 
Posts: 65 | Thanked: 21 times | Joined on Feb 2008
#7
digitalvoid:

Again, forgive me if these are dead ends, I know from experience that having someone else probe on something that I thought was obviously covered can occasionally be helpful. There are still a few loose ends and I admit I'm running out of clues or hunches...

Originally Posted by dvergin View Post
Have you performed the recent "major" OS upgrade? If I go to Settings->About_Product, I see: Version: 2.2009.51-1.002

How exactly did you put /etc/event.d/lighttpd on your N900? Did you type it in by hand or copy/paste from my post above? Did you perhaps create it on a windows machine and move it to the N900?
It would be nice if someone else would try to apply the /etc/event.d/lighttpd solution I suggested above and see what result they get. So far only two of us have reported and that's not much of a sample group to work from.
__________________
Just another perl hacker coding python in a bottle.
 
Posts: 200 | Thanked: 300 times | Joined on Nov 2009 @ The Netherlands
#8
Thanks for the effort!
 
Posts: 65 | Thanked: 21 times | Joined on Feb 2008
#9
digitalvoid:
Sorry. I didn't notice you had already posted the answers to the two questions I reposted.

Originally Posted by digitalvoid View Post
I did copy/past it with WinSCP to my device...
I thought this might be a clue. I figured DOS line endings instead of unix line endings might be causing problems for the upstart loader. So I checked.

I copied the file from my post above into a file on my windows machine. Then I scp'ed that copy to /etc/event.d/lighttpd. The size of my original /etc/event.d/lighttpd was 170 characters. The windows created one was 180 characters. That makes sense: 170 original chars plus 10 extra line ending chars. So far, so good.

Then I rebooted... and lighttpd was live. It still works with DOS line endings.

So that doesn't appear to be the problem.

I'm out of ideas.

Please. Someone else try this. We have two contradictory results and need a wider trial base.
__________________
Just another perl hacker coding python in a bottle.
 
Posts: 65 | Thanked: 21 times | Joined on Feb 2008
#10
I've sent requests to a couple of other people who may have tried this to see what results they got. Perhaps they will have time to give some feedback...
__________________
Just another perl hacker coding python in a bottle.
 
Reply


 
Forum Jump


All times are GMT. The time now is 19:16.