how to synch 2 processes to start at the same time


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting how to synch 2 processes to start at the same time
# 1  
Old 12-27-2011
how to synch 2 processes to start at the same time

Hey

Excuse me if this question is repeated everywhere but I am still new with scripting and I couldn't apply what I found to my case SmilieSmilie

I am trying to run a rec process on a ssh client and at the same time play a file from my computer so i tried this
Code:
#!/bin/bash
echo "Start"
./play output.au
ssh an@192.168.0.4 rec aaa.au silence 1 0.3 1% 1 0.3 1%

The problem is that the recording starts after the play command is done and the audio file is over.

Is there anyway I could start rec while the file is playing I can sustain a little delay but I need this delay to be a min. as possible

Thnx
Ahmed Taha

Last edited by jim mcnamara; 12-27-2011 at 09:01 PM.. Reason: code tags
# 2  
Old 12-27-2011
Hello,
Just put one in the background :

Code:
#!/bin/bash
echo "Start"
./play output.au &
ssh an@192.168.0.4 rec aaa.au silence 1 0.3 1% 1 0.3 1%

or you can also put both in background and use wait :
Code:
#!/bin/bash
echo "Start"
./play output.au &
ssh an@192.168.0.4 rec aaa.au silence 1 0.3 1% 1 0.3 1% &
wait

Dimi3


Moderator's Comments:
Mod Comment How to use code tags when posting data and code samples.

Last edited by Franklin52; 12-29-2011 at 10:30 AM.. Reason: Please use code tags for data and code samples, thank you
# 3  
Old 12-27-2011
Code:
#!/bin/bash
echo "Start"
# run the audio as a separate process
./play output.au  &
ssh an@192.168.0.4 rec aaa.au silence 1 0.3 1% 1 0.3 1%

# 4  
Old 12-27-2011
Perfect, Thnx alot
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Red Hat

NTPD service restart and time synch

I am using ntpd service to sync our RHEL 5.9 system to synch with GPS clock. When I change the RHEL system time more than 7 seconds than the present system time (through "Datetime" command), ntpd service does not adjust the system time to the present GPS time.But if the time is with in 7 seconds,... (6 Replies)
Discussion started by: Anjan Ganguly
6 Replies

2. Shell Programming and Scripting

Time synch monitoring

I'm using a debian variant. My system clock already auto synchronizes. I'd like to have some sort of alert or log entry if the time is ever off by more than a particular amount. My first choice is to have a new file created on the desktop each day that there is a slip greater than the specified... (4 Replies)
Discussion started by: jutnobs
4 Replies

3. Red Hat

Find processes by start time

How do I find the process ( which might got completed ) which were ran at specific time. for e.g. I should be able to find below process after 2 hrs if I find by time 04:00 myuser 23285 22522 0 04:00 pts/0 00:00:00 /home/myuser/bin/abc.ksh (3 Replies)
Discussion started by: sameermohite
3 Replies

4. Shell Programming and Scripting

How to calculate time difference between start and end time of a process!

Hello All, I have a problem calculating the time difference between start and end timings...! the timings are given by 24hr format.. Start Date : 08/05/10 12:55 End Date : 08/09/10 06:50 above values are in mm/dd/yy hh:mm format. Now the thing is, 7th(08/07/10) and... (16 Replies)
Discussion started by: smarty86
16 Replies

5. Solaris

How to start/stop processes

Please anyone tell me In my last interview the HR asks me how to monitor, start,stop & kill the various processes and subprocesses. Please anyone explain me clearly. It's my personal request (3 Replies)
Discussion started by: suneelieg
3 Replies

6. Shell Programming and Scripting

Start program in background (or start crontab ahead of time)

Hey! I'm working on a script that will add a user, create some configfiles, and add a crontab for the user. The crontab looks like the following: @reboot /home/user/program config.conf & I would like for this process to start at the end of my script under the corresponding username by... (0 Replies)
Discussion started by: noratx
0 Replies

7. UNIX for Advanced & Expert Users

How to log start/stop time of ALL processes

Hi all, I joined this forum today and this is my first question. I thank you all for viewing it. I will try to be brief. The OS: HP-UX B.11.11 U 9000/800 There are lot of cron scheduled perl scripts running on this server, which do different things at different time. Some of them process... (10 Replies)
Discussion started by: bluesky099
10 Replies

8. Shell Programming and Scripting

Start time/end time and status of crontab job

Is there anyway to get the start time and end time / status of a crontab job which was just completed? Of course, we know the start time of the crontab job since we are scheduling. But I would like to know process start and time recorded somewhere or can be fetched from a command like 'ps'. ... (3 Replies)
Discussion started by: thambi
3 Replies

9. Shell Programming and Scripting

Checking before start and stop processes

Hi, I have 2 start and stop sh. Start sh -------- This will start few processes. Example code: echo "start process : lgz200 /pipe=test_jobs" nohup lgz200 /db=test/test1@test1 /pipe=test_jobs > ../log/lgz200_j.log & echo "echo \"stop process (pid=$!): lgz200 /pipe=test_jobs\"" >>... (3 Replies)
Discussion started by: maldini
3 Replies
Login or Register to Ask a Question