I'm trying out the new UNIX start scripts for the first time and =
hit a small snag. I'm just testing the generic start script to start off
with. I have put the start script in my app working directory and
created a symbolic link in /etc/init.d that points to said start script.
Everything works correctly when I run /etc/init.d/webkit start... it
sees my working directory as $WORK_DIR and the AppServer in my working
directory is $APP_SERVER in the start script. Now for the problem...
I am running a Debian variant and ran update-rc.d to create the =
rcX.d entries for my run levels. These are symbolic links to the
symbolic link in /etc/init.d. The problem is that now the startup script
reports /etc/init.d as my $WORK_DIR and /etc/init.d/AppServer as my
$APP_SERVER which is incorrect and the script silently bombs out line
test -x "$APP_SERVER" || exit 5
I think the problem is in the following code:
# The location of the start sript:
if [ -h "$0" ]; then
# Get the target file if start script is given as a link:
PY_CMD=3D"import os;print os.readlink('$0')"
START_SCRIPT=3D`python -c "$PY_CMD"`
It almost needs to keep recursing through each symbolic link until it
find the end target, I'm just not sure about the best way to do this.
Seth Remington <sremington@...>
From: Christoph Zwerschke <cito@on...> - 2005-10-31 22:59:22
> I am running a Debian variant and ran update-rc.d to create the proper
> rcX.d entries for my run levels. These are symbolic links to the
> symbolic link in /etc/init.d. The problem is that now the startup script
> reports /etc/init.d as my $WORK_DIR
Good you found that problem, Seth.
You're right, the link should be followed recursively (or at least 2
steps should be resolved). The non-generic scrips use "readlink -f" for
this purpose which does just that.
However, since readlink is not available everywhere as a command, I have
used the Python readlink() function instead for the generic script
(since we may safely assume Python is installed when starting Webware...
;-)) and somehow believed it would work recursively.
As an ad hox fix I suggest replacing
PY_CMD="import os;print os.readlink('$0')"
with something like this:
I have not tested this, but if it works and nobody has a better idea, I
will check that in for version 0.9.
Also, you said that you're using a Debian variant (Ubuntu?). Does the
Debian start script not work for you? Where's the difference?
From: Christoph Zwerschke <cito@on...> - 2005-10-31 23:22:12
By the way, I also thought about adding a generic Webware Posix start
script that is not a shell script, but a pure Python script. Would that
be a silly idea? I think it should work, using the shebang mechanism.