Results 1 to 5 of 5

Thread: running a script at startup as superuser

  1. #1

    Question running a script at startup as superuser

    Hay Guys,
    I have installed OpenSUSE 11.4 using the Gnome Live USB version, and I have updated to Gnome 3.
    I use a USB CDMA modem which is not detected automatically (it never did).
    after reading a lot of forums regarding similar issues I have been able to solve my problem, I have to run this script after login,

    modprobe usbserial vendor=0X05c6 product=0x00a0
    as Root

    I was wondering is there anyway that this script runs automatically at start up.

    any help would be really appreciated.

  2. #2
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: running a script at startup as superuser

    Quick and dirty: (what I would try)

    Hack your command line into the script /etc/init.d/boot.loadmodules

    Code:
    case "$1" in
      start|restart)
        # Read variable for sysconfig and load all mentioned modules
        echo Loading required kernel modules
        . /etc/sysconfig/kernel
        for I in $MODULES_LOADED_ON_BOOT ; do
            if ! modprobe -n $I > /dev/null 2>&1 ; then continue ; fi
            modprobe $I;
        done
        modprobe usbserial vendor=0X05c6 product=0x00a0
        rc_status -v1 -r
       ;;
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

  3. #3
    Join Date
    Jun 2008
    Location
    Netherlands
    Posts
    29,740

    Default Re: running a script at startup as superuser

    @vodoo
    He asked "after login". Your solution is to do something at startup of the system, before login.

    But I agree that the OP most probably does not want this to be done after login (of whome?, every login of every user of the system?)

    This vodoo's solution comes to the fore, but as he agrees it is dirty and it most likely will be overwritten at some moment in the future.

    For this we have a special file /etc/init.d/boot.local. Add your statement there. It will be executed as root immedialtly after boot and before the statups to gain the intended runlevel.
    Henk van Velden

  4. #4

    Default Re: running a script at startup as superuser

    thanks a lot you guys, it has been solved.
    I am using vodoo's quick and dirty method, its working like a charm. but if i have troubles in future i will undo this and try HCW's way.
    thanks to both of you for being so helpful.

  5. #5
    Join Date
    Jan 2009
    Location
    Switzerland
    Posts
    1,529

    Default Re: running a script at startup as superuser

    Well, problem *almost* solved. My "quick & dirty" suggestion was meant to try as a proof of concept. Just to see if it works at all. Thank you for the feedback. The idea to hack it into boot.loadmodules had a reason: this script is executed at the very moment when the startup sequence thinks that it is the right moment to install (additional) modules.

    Now you can put it into boot.local taking boot.loadmodules as a template. If it still works, you have a good solution.
    Technology is 'stuff that doesn't work yet.' -- Bran Ferren

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •