LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   execute commands after run command (https://www.linuxquestions.org/questions/linux-newbie-8/execute-commands-after-run-command-856047/)

ajeesh.tr 01-13-2011 04:58 AM

execute commands after run command
 
I am executing a run command in a script after that i need to copy files into a directory which are the inputs for the run,on run a new shell is created and the remaining commands in the script does not execute,wot should i do to execute the remaining commands in the script??

truboy 01-13-2011 05:02 AM

Quote:

Originally Posted by ajeesh.tr (Post 4222733)
I am executing a run command in a script after that i need to copy files into a directory which are the inputs for the run,on run a new shell is created and the remaining commands in the script does not execute,wot should i do to execute the remaining commands in the script??

Show us the script/part of the script you're talking about.

an15wn 01-13-2011 05:09 AM

Double thread:
http://www.linuxquestions.org/questi...8/#post4222734

-----

Maybe you must 'debug' it step by step. If that is plain shell script, you can test it by doing one command by one.

ajeesh.tr 01-13-2011 05:25 AM

Quote:

Originally Posted by truboy (Post 4222737)
Show us the script/part of the script you're talking about.

mono --debug /home/sam/axx.exe install
cp file /home/sam/

truboy 01-13-2011 07:01 AM

Quote:

Originally Posted by ajeesh.tr (Post 4222759)
mono --debug /home/sam/axx.exe install
cp file /home/sam/

And what is not working ?

Quote:

I am executing a run command in a script after that i need to copy files into a directory which are the inputs for the run,on run a new shell is created and the remaining commands in the script does not execute,wot should i do to execute the remaining commands in the script??
- By "a run command", you mean
Code:

mono --debug /home/sam/axx.exe install
- By "the remaining commands", you mean
Code:

cp file /home/sam/
Am I right ?

AnanthaP 01-13-2011 07:12 AM

The OP is saying that `mono` executes in a spawned shell and doesn't return to the calling shell and so he is not able to execute next command which is "cp file /home/sam/" isn't executing.

. mono ... ?

truboy 01-13-2011 07:21 AM

Quote:

Originally Posted by AnanthaP (Post 4222838)
The OP is saying that `mono` executes in a spawned shell and doesn't return to the calling shell and so he is not able to execute next command which is "cp file /home/sam/" isn't executing.

Thanks for the details !

You should try :

Code:

$ mono --debug /home/sam/axx.exe install &
$ cp file /home/sam/

Or, if mono needs some time before creating file :

Code:

$ mono --debug /home/sam/axx.exe install &
$ sleep 5
$ cp file /home/sam/


ajeesh.tr 01-17-2011 12:48 AM

Quote:

Originally Posted by truboy (Post 4222828)
And what is not working ?



- By "a run command", you mean
Code:

mono --debug /home/sam/axx.exe install
- By "the remaining commands", you mean
Code:

cp file /home/sam/
Am I right ?


Yeah you are right..

ajeesh.tr 01-17-2011 12:49 AM

Quote:

Originally Posted by truboy (Post 4222844)
Thanks for the details !

You should try :

Code:

$ mono --debug /home/sam/axx.exe install &
$ cp file /home/sam/

Or, if mono needs some time before creating file :

Code:

$ mono --debug /home/sam/axx.exe install &
$ sleep 5
$ cp file /home/sam/


I tried that it is not working.

ajeesh.tr 01-17-2011 12:53 AM

Quote:

Originally Posted by AnanthaP (Post 4222838)
The OP is saying that `mono` executes in a spawned shell and doesn't return to the calling shell and so he is not able to execute next command which is "cp file /home/sam/" isn't executing.

. mono ... ?

Thank you for your reply,that is the exact issue,
mono is a command for command line execution of Mono Develop IDE ,by mono --debug is equivalent command for "Run" in the IDE

ajeesh.tr 01-17-2011 01:05 AM

Quote:

Originally Posted by ajeesh.tr (Post 4226917)
I tried that it is not working.

After the mono command ,the command in the next line is the input for the run,so the run process should be running in the background.

---------- Post added 01-17-11 at 02:05 AM ----------

Quote:

Originally Posted by truboy (Post 4222844)
Thanks for the details !

You should try :

Code:

$ mono --debug /home/sam/axx.exe install &
$ cp file /home/sam/

Or, if mono needs some time before creating file :

Code:

$ mono --debug /home/sam/axx.exe install &
$ sleep 5
$ cp file /home/sam/


After the mono command ,the command in the next line is the input for the run,so the run process should be running in the background.

truboy 01-17-2011 05:03 AM

Quote:

Originally Posted by ajeesh.tr (Post 4226934)
After the mono command ,the command in the next line is the input for the run,so the run process should be running in the background.

If you're using gnome-terminal, try in your script :

Code:

$ gnome-terminal -e 'mono --debug /home/sam/axx.exe install'
$ cp file /home/sam/

Or, if the cp command doesn't execute, run gnome-terminal in background :

Code:

$ gnome-terminal -e 'mono --debug /home/sam/axx.exe install' &
$ cp file /home/sam/

This should open a new terminal window and there you could've the input for Mono. This should work with xterm and konsole as well, just adapt the script with what you're using.

ajeesh.tr 01-17-2011 09:01 AM

Quote:

Originally Posted by truboy (Post 4227137)
If you're using gnome-terminal, try in your script :

Code:

$ gnome-terminal -e 'mono --debug /home/sam/axx.exe install'
$ cp file /home/sam/

Or, if the cp command doesn't execute, run gnome-terminal in background :

Code:

$ gnome-terminal -e 'mono --debug /home/sam/axx.exe install' &
$ cp file /home/sam/

This should open a new terminal window and there you could've the input for Mono. This should work with xterm and konsole as well, just adapt the script with what you're using.

Thank you so much its working fine ,dis was my first thread and got it solved,thanks for the responses from everyone.

ajeesh.tr 01-19-2011 08:32 AM

Quote:

Originally Posted by truboy (Post 4227137)
If you're using gnome-terminal, try in your script :

Code:

$ gnome-terminal -e 'mono --debug /home/sam/axx.exe install'
$ cp file /home/sam/

Or, if the cp command doesn't execute, run gnome-terminal in background :

Code:

$ gnome-terminal -e 'mono --debug /home/sam/axx.exe install' &
$ cp file /home/sam/

This should open a new terminal window and there you could've the input for Mono. This should work with xterm and konsole as well, just adapt the script with what you're using.

Hi,
It is working fine on my desktop but when i tried it on another machine it is throwing an error "Failed to parse arguments:

ajeesh.tr 01-19-2011 08:41 AM

Quote:

Originally Posted by truboy (Post 4227137)
If you're using gnome-terminal, try in your script :

Code:

$ gnome-terminal -e 'mono --debug /home/sam/axx.exe install'
$ cp file /home/sam/

Or, if the cp command doesn't execute, run gnome-terminal in background :

Code:

$ gnome-terminal -e 'mono --debug /home/sam/axx.exe install' &
$ cp file /home/sam/

This should open a new terminal window and there you could've the input for Mono. This should work with xterm and konsole as well, just adapt the script with what you're using.

Hi,
It is working fine on my desktop but when i tried it on another machine i.e 'gnome-terminal e'it is throwing an error

_IceTransSocketUNIXConnect: Cannot connect to non-local host sam
_IceTransSocketUNIXConnect: Cannot connect to non-local host sam
** (gnome-terminal:17803): WARNING **: Failed to connect to the session manager: Could not open network socket


All times are GMT -5. The time now is 03:50 PM.