Results 1 to 4 of 4

Thread: shell script

  1. #1
    peter is offline Registered User
    Name: Peter Jaxy
    Organization: Reihnisch Westfälisch technische Hochschule
    Project: Integrative Production Technologie
    Join Date
    Jan 2009
    Posts
    30

    shell script

    I wrote the following shell script:

    #!/bin/sh

    cd dataStreamTransferWithDataBaseSurface
    icegridregistry --Ice.Config=config.registry &
    cd Server
    streamServer --Ice.Config=config.server &
    cd ..
    cd ..
    cd dataBaseSurface
    cd asyncControl
    dataBaseSurface --Ice.Config=config.client

    And i get the error message:
    warning: commands will be executed using /bin/sh

    How I can start icegridregistry, my server and client with a shell script??

    greeting
    Peter

  2. #2
    peter is offline Registered User
    Name: Peter Jaxy
    Organization: Reihnisch Westfälisch technische Hochschule
    Project: Integrative Production Technologie
    Join Date
    Jan 2009
    Posts
    30

    shell script

    I changed my previous shell script to this version (filename: batch):

    #!/bin/sh

    cd dataStreamTransferWithDataBaseSurface
    echo "Starting registry ..."
    icegridregistry --Ice.Config=config.registry &
    sleep 2
    echo "done."
    cd Server
    echo "Starting server ..."
    ./streamServer --Ice.Config=config.server &
    sleep 2
    echo "done."
    cd ..
    cd ..
    cd dataBaseSurface
    cd asyncControl
    echo "Starting client ..."
    ./dataBaseSurface --Ice.Config=config.client

    And I can start my shell script with:
    $ bash batch

    And I have the following questions:
    How I can wait, until a process is finisted, without using sleep??
    How in my script I can start the server in a new console??

    greeting

    Peter

  3. #3
    xdm's Avatar
    xdm
    xdm is offline ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruña, Spain
    Posts
    588
    Hi,

    warning: commands will be executed using /bin/sh
    This warning only means that commands in the script are executed using /bin/sh shell.

    cd dataStreamTransferWithDataBaseSurface
    icegridregistry --Ice.Config=config.registry &
    cd Server
    streamServer --Ice.Config=config.server &
    cd ..
    cd ..
    cd dataBaseSurface
    cd asyncControl
    dataBaseSurface --Ice.Config=config.client
    If you want to start icegridregistry as a daemon, don't use '&', when this could work is better to pass --daemon to igridregistry.

    I will also avoid all the 'cd' it made the script complex. IMO is better to use absolute paths with in your scripts.

    In a bash compatible shell this should work.

    ICE_HOME="/opt/Ice-3.3"
    ICEGRID=$ICE_HOME"/bin/icegridregistry"

    MYAPP_HOME="/opt/myapp"

    GRID_CONFIG=$MYAPP_HOME"/config/config.grid"


    SERVER_CONFIG=$MYAPP_HOME"/config/config.server"
    SERVER=$MYAPP_HOME"/bin/server"

    CLIENT_CONFIG=$MYAPP_HOME"/config/config.client"
    CLIENT=$MYAPP_HOME"/bin/client"

    #
    # Start icegridnode node.
    #
    $ICEGRID --Ice.Config=$GRID_CONFIG --daemon

    #
    # Start myapp server
    #
    $SERVER --Ice.Config=$SERVER_CONFIG &


    #
    # Start myapp client
    #
    $CLIENT --Ice.Config=$CLIENT_CONFIG
    To start your own server as a daemon is better that you inherit from Ice::Service, and then start the server with --daemon option instead of use '&' in the script.

    If you are using RHEL or SUSE you could be interested in the init.d scripts that are provided to start ice services:

    /etc/init.d/glacier2router
    /etc/init.d/icegridnode
    /etc/init.d/icegridregistry

    Cheers,
    José

  4. #4
    bernard's Avatar
    bernard is offline ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    Hi Peter,

    I don't know why you get this warning: it's not Ice-related. A work-around could be to use !/bin/bash for our shell script.

    I would also suggest to use --daemon to start the IceGrid registry, instead of putting it background. This way, the IceGrid registry will fork itself and wait until it's started to return and let the script continue. You could also do the same for your streamServer server: see 8.3.2 The Ice::Service Class in the Ice manual (http://www.zeroc.com/doc/Ice-3.3.1/m...Cpps.9.3.html).

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 04-17-2009, 03:46 AM
  2. tree script and slice2lua
    By Sheff in forum Projects
    Replies: 4
    Last Post: 03-19-2009, 04:57 AM
  3. Replies: 1
    Last Post: 06-21-2006, 11:41 PM
  4. how to invoke an external shell script in ice?
    By ewiniar in forum Help Center
    Replies: 2
    Last Post: 04-21-2006, 03:28 AM

Posting Permissions

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