Having problems with rc.local

jim ruxton cinetron at passport.ca
Wed Sep 14 17:18:01 UTC 2005


On Wed, 2005-09-14 at 09:24 -0700, Rick Stevens wrote:
> jim ruxton wrote:
> [snip]
> >>I think I missed which OS this was.  If it's FC4 or a 2.6.11 kernel,
> >>there are issues with udev not enumerating correctly and requiring a
> >>status change on the port (unplug, plug will do it).  Supposedly fixed
> >>in 2.6.12-1.1447, but I won't swear to it.
> > 
> > 
> > Well I thought I was getting somewhere. I decided to use the script that
> > is started when the camera is turned on to start my script. When the
> > camera is switched on or plugged in the script /etc/hotplug/usb/usbcam
> > is started. If I start my script normally in this script all looks good.
> > ie. 
> >  /home/jim/capture/camera_start_script.sh & but it is run by root.
> > 
> > but if I try to start it as a user ie.
> > 
> > su - jim -c /home/jim/capture/camera_start_script.sh &
> > 
> > then for some reason 3 copies of the script get executed. I can't figure
> > out what is going on here, any ideas? I only need 1 copy to run, in fact
> > three copies running messes me up?? Thanks for any suggestions.
> 
> Oops, disregard my last posting (mouse button stuck).
> 
> We'd need to see the script itself, Jim.
Thanks Rick,
Here is the script that starts the camera
ie.  /home/jim/capture/camera_start_script.sh:

#!/bin/sh
#
# This script starts camera
capture start &
cd /home/jim/capture
python pythoncapture.py &

and here is the usbcam script that starts when camera is turned on or
plugged in:

#!/bin/bash
# $Id: usbcam.console,v 1.4 2002/09/12 16:50:18 hun Exp $
#
# /etc/hotplug/usb/usbcam
#
# Sets up newly plugged in USB camera so that the user who owns
# the console according to pam_console can access it from user space
#
# Note that for this script to work, you'll need all of the following:
# a) a line in the file /etc/hotplug/usermap that corresponds to the
#    camera you are using. You can get the correct lines for all cameras
#    supported by libgphoto2 by running "print-usb-usermap".
# b) a setup using pam_console creates the respective lock files
#    containing the name of the respective user. You can check for that
#    by executing "echo `cat /var/{run,lock}/console.lock`" and
#    verifying the appropriate user is mentioned somewhere there.
# c) a Linux kernel supporting hotplug and usbdevfs
# d) the hotplug package (http://linux-hotplug.sourceforge.net/)
#
# In the usermap file, the first field "usb module" should be named
# "usbcam" like this script.
#

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
    # New code, using lock files instead of copying /dev/console
permissions
    # This also works with non-gdm logins (e.g. on a virtual terminal)
    # Idea and code from Nalin Dahyabhai <nalin at redhat.com>
    if [ -f /var/run/console/console.lock ]
    then
        CONSOLEOWNER=`cat /var/run/console/console.lock`
    elif [ -f /var/run/console.lock ]
    then
        CONSOLEOWNER=`cat /var/run/console.lock`
    elif [ -f /var/lock/console.lock ]
    then
        CONSOLEOWNER=`cat /var/lock/console.lock`
    else
        CONSOLEOWNER=
    fi
    if [ -n "$CONSOLEOWNER" ]
    then
        chmod 0000 "${DEVICE}"
        chown "$CONSOLEOWNER" "${DEVICE}"
        chown "$USER" "${DEVICE}"
        chmod 0600 "${DEVICE}"
    fi
fi
killall -9 capture python
su - jim -c /home/jim/capture/camera_start_script.sh &

I put the killall in there just to try and be sure there are no other
copies running but doesn't help. Any thoughts. Also for some reason my
last 2 emails haven't been going to the install list. Not sure what is
up with that.

Thanks again.
Jim





> ----------------------------------------------------------------------
> - Rick Stevens, Senior Systems Engineer     rstevens at vitalstream.com -
> - VitalStream, Inc.                       http://www.vitalstream.com -
> -                                                                    -
> -   To understand recursion, you must first understand recursion.    -
> ----------------------------------------------------------------------
> 




More information about the Redhat-install-list mailing list