Automate a process using bash script
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I have a unimrcp client process (ucp) and I want to spawn multiple ucp using shell script.
Whenever I spawn a ucp, it returns a command line using which I can access different functionalities in ucp. So I want to write a script that achieves following,
- Spawn a ucp process
- wait until the ucp's command line appears
- access ucp's functionality with a command "run recog"
Note that ./ucp && run recog does not work since ./ucp is finished only after we exit from the command line of ucp.
I tried the following for this,
#!/bin/bash
./ucp &
fg
echo "run recog uni2"
wait
However, ./ucp &
results into starting the client process and then writing "?????" on the client console resulting into "????" command not found. Following are the logs,
./script.sh
2018-10-23 14:36:53:618851 [INFO] Set Property ip:127.0.0.1
2018-10-23 14:36:53:618851 [INFO] Register Codec [PCMU]
2018-10-23 14:36:53:618851 [INFO] Register Codec [PCMA]
2018-10-23 14:36:53:618851 [INFO] Register Codec [L16]
2018-10-23 14:36:53:618851 [NOTICE] Register Resource [speechsynth]
2018-10-23 14:36:53:618851 [NOTICE] Register Resource [speechrecog]
2018-10-23 14:36:53:620588 [NOTICE] Register Resource [recorder]
2018-10-23 14:36:53:620588 [NOTICE] Register Resource [speakverify]
2018-10-23 14:36:53:620593 [INFO] Register Resource Factory
2018-10-23 14:36:53:620600 [NOTICE] Create SofiaSIP Agent [SIP-Agent-1] [1.12.11-227-g73efc97] sip:127.0.0.1:8062;transport=udp
2018-10-23 14:36:53:620600 [INFO] Register Signaling Agent [SIP-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create RTSP Client [RTSP-Agent-1] [100]
2018-10-23 14:36:53:620600 [INFO] Register Signaling Agent [RTSP-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create MRCPv2 Agent [MRCPv2-Agent-1] [100]
2018-10-23 14:36:53:620600 [INFO] Register Connection Agent [MRCPv2-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create Media Engine [Media-Engine-1]
unknown command: ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Is this the right way to achieve what I mentioned in the question? (spawn a client and run a command on its console)? If yes, why does the "./ucp &" results in reading "?????" considering that as input to its console? Note that this does not happen if I simply fire "./ucp & fg " from the console. It can see the expected behavior of the command when I do it from the console. The issue appears when I try to execute the script.
If this is not a right way, How can I achieve what I mentioned in the question? (1, 2, and 3)
Thank you
linux shell-script process
New contributor
sbhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
favorite
I have a unimrcp client process (ucp) and I want to spawn multiple ucp using shell script.
Whenever I spawn a ucp, it returns a command line using which I can access different functionalities in ucp. So I want to write a script that achieves following,
- Spawn a ucp process
- wait until the ucp's command line appears
- access ucp's functionality with a command "run recog"
Note that ./ucp && run recog does not work since ./ucp is finished only after we exit from the command line of ucp.
I tried the following for this,
#!/bin/bash
./ucp &
fg
echo "run recog uni2"
wait
However, ./ucp &
results into starting the client process and then writing "?????" on the client console resulting into "????" command not found. Following are the logs,
./script.sh
2018-10-23 14:36:53:618851 [INFO] Set Property ip:127.0.0.1
2018-10-23 14:36:53:618851 [INFO] Register Codec [PCMU]
2018-10-23 14:36:53:618851 [INFO] Register Codec [PCMA]
2018-10-23 14:36:53:618851 [INFO] Register Codec [L16]
2018-10-23 14:36:53:618851 [NOTICE] Register Resource [speechsynth]
2018-10-23 14:36:53:618851 [NOTICE] Register Resource [speechrecog]
2018-10-23 14:36:53:620588 [NOTICE] Register Resource [recorder]
2018-10-23 14:36:53:620588 [NOTICE] Register Resource [speakverify]
2018-10-23 14:36:53:620593 [INFO] Register Resource Factory
2018-10-23 14:36:53:620600 [NOTICE] Create SofiaSIP Agent [SIP-Agent-1] [1.12.11-227-g73efc97] sip:127.0.0.1:8062;transport=udp
2018-10-23 14:36:53:620600 [INFO] Register Signaling Agent [SIP-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create RTSP Client [RTSP-Agent-1] [100]
2018-10-23 14:36:53:620600 [INFO] Register Signaling Agent [RTSP-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create MRCPv2 Agent [MRCPv2-Agent-1] [100]
2018-10-23 14:36:53:620600 [INFO] Register Connection Agent [MRCPv2-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create Media Engine [Media-Engine-1]
unknown command: ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Is this the right way to achieve what I mentioned in the question? (spawn a client and run a command on its console)? If yes, why does the "./ucp &" results in reading "?????" considering that as input to its console? Note that this does not happen if I simply fire "./ucp & fg " from the console. It can see the expected behavior of the command when I do it from the console. The issue appears when I try to execute the script.
If this is not a right way, How can I achieve what I mentioned in the question? (1, 2, and 3)
Thank you
linux shell-script process
New contributor
sbhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have a unimrcp client process (ucp) and I want to spawn multiple ucp using shell script.
Whenever I spawn a ucp, it returns a command line using which I can access different functionalities in ucp. So I want to write a script that achieves following,
- Spawn a ucp process
- wait until the ucp's command line appears
- access ucp's functionality with a command "run recog"
Note that ./ucp && run recog does not work since ./ucp is finished only after we exit from the command line of ucp.
I tried the following for this,
#!/bin/bash
./ucp &
fg
echo "run recog uni2"
wait
However, ./ucp &
results into starting the client process and then writing "?????" on the client console resulting into "????" command not found. Following are the logs,
./script.sh
2018-10-23 14:36:53:618851 [INFO] Set Property ip:127.0.0.1
2018-10-23 14:36:53:618851 [INFO] Register Codec [PCMU]
2018-10-23 14:36:53:618851 [INFO] Register Codec [PCMA]
2018-10-23 14:36:53:618851 [INFO] Register Codec [L16]
2018-10-23 14:36:53:618851 [NOTICE] Register Resource [speechsynth]
2018-10-23 14:36:53:618851 [NOTICE] Register Resource [speechrecog]
2018-10-23 14:36:53:620588 [NOTICE] Register Resource [recorder]
2018-10-23 14:36:53:620588 [NOTICE] Register Resource [speakverify]
2018-10-23 14:36:53:620593 [INFO] Register Resource Factory
2018-10-23 14:36:53:620600 [NOTICE] Create SofiaSIP Agent [SIP-Agent-1] [1.12.11-227-g73efc97] sip:127.0.0.1:8062;transport=udp
2018-10-23 14:36:53:620600 [INFO] Register Signaling Agent [SIP-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create RTSP Client [RTSP-Agent-1] [100]
2018-10-23 14:36:53:620600 [INFO] Register Signaling Agent [RTSP-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create MRCPv2 Agent [MRCPv2-Agent-1] [100]
2018-10-23 14:36:53:620600 [INFO] Register Connection Agent [MRCPv2-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create Media Engine [Media-Engine-1]
unknown command: ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Is this the right way to achieve what I mentioned in the question? (spawn a client and run a command on its console)? If yes, why does the "./ucp &" results in reading "?????" considering that as input to its console? Note that this does not happen if I simply fire "./ucp & fg " from the console. It can see the expected behavior of the command when I do it from the console. The issue appears when I try to execute the script.
If this is not a right way, How can I achieve what I mentioned in the question? (1, 2, and 3)
Thank you
linux shell-script process
New contributor
sbhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I have a unimrcp client process (ucp) and I want to spawn multiple ucp using shell script.
Whenever I spawn a ucp, it returns a command line using which I can access different functionalities in ucp. So I want to write a script that achieves following,
- Spawn a ucp process
- wait until the ucp's command line appears
- access ucp's functionality with a command "run recog"
Note that ./ucp && run recog does not work since ./ucp is finished only after we exit from the command line of ucp.
I tried the following for this,
#!/bin/bash
./ucp &
fg
echo "run recog uni2"
wait
However, ./ucp &
results into starting the client process and then writing "?????" on the client console resulting into "????" command not found. Following are the logs,
./script.sh
2018-10-23 14:36:53:618851 [INFO] Set Property ip:127.0.0.1
2018-10-23 14:36:53:618851 [INFO] Register Codec [PCMU]
2018-10-23 14:36:53:618851 [INFO] Register Codec [PCMA]
2018-10-23 14:36:53:618851 [INFO] Register Codec [L16]
2018-10-23 14:36:53:618851 [NOTICE] Register Resource [speechsynth]
2018-10-23 14:36:53:618851 [NOTICE] Register Resource [speechrecog]
2018-10-23 14:36:53:620588 [NOTICE] Register Resource [recorder]
2018-10-23 14:36:53:620588 [NOTICE] Register Resource [speakverify]
2018-10-23 14:36:53:620593 [INFO] Register Resource Factory
2018-10-23 14:36:53:620600 [NOTICE] Create SofiaSIP Agent [SIP-Agent-1] [1.12.11-227-g73efc97] sip:127.0.0.1:8062;transport=udp
2018-10-23 14:36:53:620600 [INFO] Register Signaling Agent [SIP-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create RTSP Client [RTSP-Agent-1] [100]
2018-10-23 14:36:53:620600 [INFO] Register Signaling Agent [RTSP-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create MRCPv2 Agent [MRCPv2-Agent-1] [100]
2018-10-23 14:36:53:620600 [INFO] Register Connection Agent [MRCPv2-Agent-1]
2018-10-23 14:36:53:620600 [NOTICE] Create Media Engine [Media-Engine-1]
unknown command: ??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
Is this the right way to achieve what I mentioned in the question? (spawn a client and run a command on its console)? If yes, why does the "./ucp &" results in reading "?????" considering that as input to its console? Note that this does not happen if I simply fire "./ucp & fg " from the console. It can see the expected behavior of the command when I do it from the console. The issue appears when I try to execute the script.
If this is not a right way, How can I achieve what I mentioned in the question? (1, 2, and 3)
Thank you
linux shell-script process
linux shell-script process
New contributor
sbhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
sbhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
sbhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 17 mins ago
sbhatt
101
101
New contributor
sbhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
sbhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
sbhatt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
sbhatt is a new contributor. Be nice, and check out our Code of Conduct.
sbhatt is a new contributor. Be nice, and check out our Code of Conduct.
sbhatt is a new contributor. Be nice, and check out our Code of Conduct.
sbhatt is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f477612%2fautomate-a-process-using-bash-script%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password