0

I need to execute a remote application (named ConnectionManager), which uses the ncurses library, on the remote server launching it from a local pc.

ConnectionManager is a program wich use ncurses and forks another process (itself) and waits for incoming tcp/ip connection.

On a:

Distributor ID: ScientificSL
Description:    Scientific Linux SL release 5.5 (Boron)
Release:        5.5
Codename:       Boron
(Like Centos5.5)

I use this script:

#!/bin/bash
INFORMIXDIR=/opt/informix
INFORMIXSERVER=server1_on
ONCONFIG=onconfig.eda
PATH=$PATH:$INFORMIXDIR/bin
export INFORMIXDIR INFORMIXSERVER ONCONFIG PATH
echo $INFORMIXSERVER
echo $ONCONFIG
echo "Launch ConnectionManager"
export DISPLAY=:0.0 && xterm -e 'sudo -E /opt/informix/server /ConnectionManager' 

and it all works.

The previous script doesn't work on

Distributor ID: Scientific
Description:    Scientific Linux release 6.4 (Carbon)
Release:        6.4
Codename:       Carbon

The ConnectionManager doesn't allow an IP connection.

I want to leave the ConnectionManager program running in a remote machine, also when I launch it from a local machine.

What's wrong?

I have tried screen -d -m ./ConnectionManager. The application works, but I don't see it on remote machine. I need to see the ConnectionManager within an xterm window.

Is it possible that sudo is blocking ConnectionManager tcp/ip connections ?

Update: When I use this command: sudo './ConnectionManager' I have immediately the following message: [1]+ Stopped sudo './ConnectionManager'

I have check the code and the problem is the instruction int setpgrp(void) in ConnectionManager.

Why ?

  • don't understand much, but ... have you check firewall? if that is based on Centos, I believe it might have selinux. Is it enabled? did you chek /var/log/messages for errors? – BitsOfNix Jul 19 '13 at 9:10
  • There is no firewall, and selinux is disabled, if I run ./ConnectionManager working properly. It doesn't work only when I use the above script . – famedoro Jul 19 '13 at 9:25
  • Consider using screen, tmux or some other terminal multiplexer to allow you to run a program independent of your own login session. – user Jul 19 '13 at 9:52
  • Hi Michael Kjörling, could you give me an example ? On the remote machine must be seen the ConnectionManager within the an xterm window. – famedoro Jul 19 '13 at 10:31
  • Do you need to be able to see the xterm that you're running the sudo command inside or is it enough to see the output from the ConnectionManager command? – slm Jul 19 '13 at 11:11
0

As @MichaelKjörling suggested in the comments you can run ConnectionManager or the script in a terminal multiplexer such as screen or tmux.

With your example command you were almost all the way there:

$ screen -d -m ./ConnectionManager

Once this command runs you're detached from the terminal so you'd see no output after ConnectionManager starts up. You can reconnect to this particular screen session with this command:

$ screen -r

To disconnect from it you use the key combination Control+A+D. I always remember the mnemonic "attention" + "disconnect".

If you need to use the script, you can modify it slightly so that it too can also be run in a screen session.

#!/bin/bash
INFORMIXDIR=/opt/informix
INFORMIXSERVER=server1_on
ONCONFIG=onconfig.eda
PATH=$PATH:$INFORMIXDIR/bin
export INFORMIXDIR INFORMIXSERVER ONCONFIG PATH
echo $INFORMIXSERVER
echo $ONCONFIG
echo "Launch ConnectionManager"
sudo -E /opt/informix/server/ConnectionManager

You could then run this script the same way as ConnectionManager in a screen session:

$ screen -d -m yourscript.bash

And use the same connect, disconnect methods I mentioned above. With screen if you have more than one screen "session" you can use this command to list them out:

$ screen -ls

And then pick one from the list to connect to:

$ screen -r <name>

For example:

$ screen -ls
There are screens on:
    1506.bp (Detached)
    32090.dl    (Detached)
2 Sockets in /var/run/screen/S-root.

$ screen -r 32090.dl
  • Thanks for your response, the problem is that the instruction sudo -E /opt/informix/server/ConnectionManager doesn't work – famedoro Jul 19 '13 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.