-
Notifications
You must be signed in to change notification settings - Fork 0
/
test-server2.sh
executable file
·43 lines (33 loc) · 1.04 KB
/
test-server2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#/bin/bash
if [ $# -ne 2 ]
then
echo "Usage: `basename $0` server-prog port"
exit 1
fi
SERVER=$1
PORT=$2
echo "Start Test 2"
#echo Killing Server if any
PID=`ps | grep IRCServer | awk '{ print $1;}'`
kill -9 $PID 2> /dev/null
sleep 2
#Start server in the background
rm -f password.txt
$SERVER $PORT > talk-server.out &
sleep 1
echo Add Users
./TestIRCServer localhost $PORT "ADD-USER superman clarkkent"
./TestIRCServer localhost $PORT "ADD-USER spiderman peterpark"
./TestIRCServer localhost $PORT "ADD-USER aquaman xyz"
./TestIRCServer localhost $PORT "ADD-USER mary poppins"
echo Create Room
./TestIRCServer localhost $PORT "CREATE-ROOM superman clarkkent java-programming"
echo Enter room
./TestIRCServer localhost $PORT "ENTER-ROOM superman clarkkent java-programming"
./TestIRCServer localhost $PORT "ENTER-ROOM aquaman xyz java-programming"
echo Print users in room
./TestIRCServer localhost $PORT "GET-USERS-IN-ROOM superman clarkkent java-programming"
# Kill server
echo Killing Server
PID=`ps | grep IRCServer | awk '{ print $1;}'`
kill -9 $PID