Hi, this is my first approach to shell scripts and I’m a bit lost .
I have a server-client app, and I want to run a server with a pair of clients. So I run this 3 processes in background, but when I need to stop them, I don’t know how. Is there any equivalent to Ctrl-C with shell scripts?
I’ve been searching on bash man for something like getting its pid and later killing them, but couldn’t find how. Any suggestion?
And another silly question is How can I make my shell wait for N seconds before running next command?
I need the second client to start about 20 secs after the 1st one has connected so I’ve solved this by repeating a few “ls” between them but its ridiculous and I’m sure there has to be another way.
To give you an idea of how newbie I am, here’s my script:
Code:
#!/bin/bash
set –x
cd server
./run > servertrc.txt &
ls
ls
[..]
ls
cd ../client1
./run &
ls
ls
[..]
ls
cd ../client2
./run &
exit 0
Thanks for any help or hint!