Problems writing an upstart job
Wolfgang Holoch
wolfgang.holoch at gmx.de
Thu Nov 19 22:02:15 GMT 2009
Hello everybody,
I am sorry to post this in the development list, because this is not a
development concern, but also not a bug to post it in launchpad, so this
was the last remaining place for me to find help.
Background
I am the owner of an older notebook with two graphic boards built-in
and a little switcher in front of the notebook to choose - before
startup - one of these boards.
Each of these boards need a separate xorg.conf file and two different
libs to work properly. Until now I used a tiny SysVinit script to
manage these dependencies, but after a update to Ubuntu 9.10 I have to
migrate this older SysVinit script into upstart.
First steps
At first I tried a upstart configuration like that:
====================================
start on starting gdm
script
# ...
end script
====================================
because I thought that would be sufficient, but it did not work. I
always got an error message in my syslog like that:
"initgb main process (2733) terminated with status 1"
and the script did not changed anything as expected.
Further steps
I also tried "start on startup" but with the same result, then I tried
some further stuff but without success. I am also a little bit confused
about the event "graphics-device-added" which is noticed in the gdm.conf
file but I did not found any clue where this event is coming from.
Notice
The script I am using works very well if I am execute it as a normal
shell script as well as I invoke the script via upstart in a running
system ("initctl start initgb"), it just does not work on startup.
I attached my last upstart configuration file for further references.
I tried to figure it out on my own for several days but now I am at a
loss.
I appreciate every help or hint.
Best regards.
Wolfgang
-------------- next part --------------
# initgb - Initialize graphic board settings
#
# This is a special script for an old "Cebop HEL 700" notebook to initialize the
# graphic board.
description "Initialize graphic board settings"
start on startup
#start on starting gdm
script
# For which string should be searched in lspci.
NV_PCI_SEARCH_STR="GeForce Go 6600"
# The paths to all necessary files.
FILE_XORG="/etc/X11/xorg.conf"
FILE_IN_XORG="/etc/X11/xorg.conf.intel"
FILE_NV_XORG="/etc/X11/xorg.conf.nvidia"
FILE_LIBGL="/usr/lib/libGL.so.1"
FILE_IN_LIBGL="/usr/lib/libGL.so.1.2"
FILE_NV_LIBGL="/usr/lib/libGL.so.185.18.36"
FILE_LIBGLX="/usr/lib/xorg/modules/extensions/libglx.so"
FILE_IN_LIBGLX="/usr/lib/xorg/modules/extensions/libglx.so.1"
FILE_NV_LIBGLX="/usr/lib/xorg/modules/extensions/libglx.so.185.18.36"
# Remove a link and backup an existing file.
# This function needs one argument.
rmlink () {
# We only proceed if we got one argument.
if [ $# -eq 1 ]; then
# Check if this file exists.
if [ -e "$1" ]; then
# If this file is a link just remove it, otherwise make a backup.
if [ -L "$1" ]; then
rm -f "$1"
else
mv -f "$1" "${1}.backup"
fi
fi
fi
}
# Which board is set, nvboard will be one if the nvidia board is available,
# otherwise zero.
nvboard=$(lspci | grep -ci "$NV_PCI_SEARCH_STR")
# Remove the existing xorg.conf, libGL.so and libglx.so links.
rmlink $FILE_XORG
rmlink $FILE_LIBGL
rmlink $FILE_LIBGLX
# Make new links for...
if [ $nvboard -gt 0 ]; then
# the nvidia board.
ln -s "$FILE_NV_XORG" "$FILE_XORG"
ln -s "$FILE_NV_LIBGL" "$FILE_LIBGL"
ln -s "$FILE_NV_LIBGLX" "$FILE_LIBGLX"
else
# the intel board.
ln -s "$FILE_IN_XORG" "$FILE_XORG"
ln -s "$FILE_IN_LIBGL" "$FILE_LIBGL"
ln -s "$FILE_IN_LIBGLX" "$FILE_LIBGLX"
fi
end script
More information about the upstart-devel
mailing list