shell script

in Help Center
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
#!/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
0
Comments
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
This warning only means that commands in the script are executed using /bin/sh shell.
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.
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é
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/manual/Cpps.9.3.html).
Best regards,
Bernard