Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19

Warning: Function ereg() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 4

Warning: Function split() is deprecated in ..../includes/class_postbit.php(345) : eval()'d code on line 19
Problems starting a program in rc.d
Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Problems starting a program in rc.d

  1. #1
    Schion65
    Guest

    Problems starting a program in rc.d

    Sorry if this is in the wrong place, I'm new.

    I have a resource manager (RM, a program which opens up and sits on other processes) that I am attempting to run on startup. I can run the program successfully, however the processes which start under it will not run at all. I've placed a script in /etc/init.d that calls another script which starts up the RM. If I do not start the RM on boot-up, but rather just run the script which starts it after I've logged in, it runs fine.
    I initially thought that it the environment variables weren't getting set right (since the processes depend on these enviroment variables for execution), but I echo'ed the env to a file and all the pertinent variables are there. Any help would be most appreciated.

    I su to myself so that I'm not running it as root.
    I have Redhat 7.2-something, I can't find the exact version number.

    Hopefully I've given you all the pertinent information. Thanks in advance.

  2. #2
    JimH
    Guest

    Re:Problems starting a program in rc.d

    If your script depends on bash environment variables to be set before it works correctly, you will not be able to run it at boot. Bash environment variables are set when a user logs in.

    When a user logs in bash reads and executes commands, if the files exist, in this order:

    /etc/profile, ~/.bash_profile, ~/.bash_login, ~./profile

    Jim H

  3. #3
    Schion65
    Guest

    Re:Problems starting a program in rc.d

    I need some help clearing this up. If my script, or rather the program run by the script, depends on environment variable THIS_ONE, and I 'echo' the 'env' to a file and THIS_ONE shows up and has the correct value, shouldn't the program have the environment variable it needs? Whew, what a sentence.

    It seems to me that if the environment is setup correctly before the program is executed, it should have the variables it needs. So, if I check the 'env' just before executing the program, it should relay the 'env' at that point.

    I'm using 'su [my_user_name] -c [command]' which I was given to understand, started a new shell of the type the user uses. This seems to be confirmed in the 'env' which indicates a tcsh.

    Sorry if I seem a bit dense, I'm just trying to get a handle on this. Thanks.

  4. #4
    JimH
    Guest

    Re:Problems starting a program in rc.d

    Quote Originally Posted by Schion65
    I need some help clearing this up. If my script, or rather the program run by the script, depends on environment variable THIS_ONE, and I 'echo' the 'env' to a file and THIS_ONE shows up and has the correct value, shouldn't the program have the environment variable it needs? Whew, what a sentence.
    Yes, but only if the env variable exists. If your program relies on an env variable that does not exist until the user logins then the program won't work at boot.

    Jim H

  5. #5
    Schion65
    Guest

    Re:Problems starting a program in rc.d

    Quote Originally Posted by JimH
    Yes, but only if the env variable exists. If your program relies on an env variable that does not exist until the user logins then the program won't work at boot.
    Ok, so if the env variable does not exist then my program will not work, I'm clear on that. What's a little fuzzier is how I check for existance. I was assuming, perhaps incorrectly, that if the variable shows up in the env just before the program is executed (i.e. inside the script that executes the program, which I'm told is it's own shell) then the variable exists.
    Have I misunderstood? If so, how can I ensure that all of my env variables are in existance before I execute the program? Thank you.

    Schion

  6. #6
    JimH
    Guest

    Re:Problems starting a program in rc.d

    Insert some temporary debugging lines in your script.

    Maybe when the script executes have it create a log file, then as it looks for each env variable have it output to the log file whether or not the variable exists and its value. If everything is good there then we will know the problem is elsewhere.

    Jim H

  7. #7
    Schion65
    Guest

    Re:Problems starting a program in rc.d

    I have the script output to a log file the env variable that the program depends on. It shows up and its the correct name. So, I'm still unsure as to why it's not executing correctly. Thanks again.


  8. #8
    JimH
    Guest

    Re:Problems starting a program in rc.d

    The type of program are you starting with the script? C/C++? Perl, python, etc.....?

    I will probably need to see the script now.

    Where exactly did you install your script? Did you place a symlink to it in the right directory for the runlevel you are booting?

    Jim H

  9. #9
    Schion65
    Guest

    Re:Problems starting a program in rc.d

    Quote Originally Posted by JimH
    The type of program are you starting with the script? C/C++? Perl, python, etc.....?
    I am starting a C++ program, which starts other C++ programs.

    Quote Originally Posted by JimH
    I will probably need to see the script now.

    Where exactly did you install your script? Did you place a symlink to it in the right directory for the runlevel you are booting?
    I'll put the scripts below. I installed my script in init.d, and I placed a S98Name link in rc3.d (I'm using run level 3), and a K98Name link in rc6.d.

    As for the scripts, the first script is the one in init.d, that calls the second script. The second script calls scripts which start the individual programs. The reason I did this is because I want to have scripts which will monitor these programs and retart them should they die (note:I've not put this functionality in yet). Sorry if this is a little confusing, I'm constrained by my requirements.
    The startMW and startSsmbg both function perfectly. Lrm itself appears to work, however, any processes started by it do not work.
    ------------------
    #!/bin/sh
    # Startup script for RSS
    #

    # Source function library.
    . /etc/rc.d/init.d/functions

    insmod /home/swalton/dev/PHOTONICS/src/pmw/common/viper/rgb/viper_rgb.o
    insmod /home/swalton/dev/PHOTONICS/src/pmw/common/viper/quad/viper_quad.o

    var=$(env)
    echo "$var" >& /tmp/RSSenv

    prog="RSS"

    start() {
    echo -n $"Starting $prog: "
    su sbrennan -c /home/sbrennan/build/bin/startRSS
    RETVAL=$?
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/anacron
    echo
    return $RETVAL
    }

    stop() {

    echo -n $"Stopping $prog: "
    killproc /home/sbrennan/build/bin/startRSS
    echo
    RETVAL=$?
    return $RETVAL
    }

    case "$1" in
    start)
    start
    ;;

    stop)
    stop
    ;;

    status)
    status /home/sbrennan/build/bin/startRSS
    ;;
    restart)
    stop
    start
    ;;

    *)
    echo $"Usage: $0 {start|stop|restart|status}"
    exit 1

    esac

    exit 0
    --------------startRSS
    #!/bin/bash
    #
    # Script to start a screr, the Lrm, and Ssmbg.
    # Note: Certain env's must be set prior to execution.
    #

    cd /home/sbrennan/build/bin

    var=$(env)
    echo "$var" >& /home/sbrennan/startRSSenv

    ./startMW
    ./startSsmbg
    ./startLrm

    ---------------------startLrm
    #!/bin/bash
    #
    # Script to Start the LRM ( Should be run in Host Machine )
    #

    IP_ADDRESS=###.#.#.#
    NETWORK_PORT=16000
    LOCAL_PORT=16001
    LRM_GTI=1000
    BINDIR=/home/sbrennan/build/bin


    var=$(env)
    echo "$var" >& /home/sbrennan/startLrmenv

    echo "$APP_CONFIG_DIR" >& /home/sbrennan/APPpresent

    ${BINDIR}/RSSlrm.linux ${IP_ADDRESS} ${NETWORK_PORT} ${LOCAL_PORT} -1 0 0 18888
    MW_LRM r 0 0 0 f &


  10. #10
    JimH
    Guest

    Re:Problems starting a program in rc.d

    OK, I just walked in the door give me a little while and I will look through what you posted. ;D


    Jim H

Similar Threads

  1. Problems starting Oracle
    By tech291083 in forum Redhat / Fedora
    Replies: 2
    Last Post: 10-20-2007, 09:18 AM
  2. Screensaver program problems
    By suebaby41 in forum Windows - General Topics
    Replies: 1
    Last Post: 03-16-2005, 02:21 AM
  3. starting a program when kde loads
    By gohbucks69 in forum Linux - Software, Applications & Programming
    Replies: 11
    Last Post: 01-13-2005, 03:56 AM
  4. Starting gdm
    By LiNuts in forum Linux - Software, Applications & Programming
    Replies: 7
    Last Post: 02-11-2002, 11:35 AM
  5. Thats it... I am starting over.
    By groundzero in forum Linux - Hardware, Networking & Security
    Replies: 16
    Last Post: 01-31-2002, 11:08 AM

Bookmarks

Posting Permissions

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