-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathrun-multiple-terminals.sh
executable file
·61 lines (50 loc) · 1.57 KB
/
run-multiple-terminals.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/bash
#
# run-multiple-terminals.sh <mode> <language> <db_name> [<username>] [<password>]
#
# Start cogserver on the local machine
# This runs tmux with byobu to multiplex several terminals;
# Use F3 and F4 to swtich to the other terminals.
#
# Work around an lxc-attach bug.
if [[ `tty` == "not a tty" ]]
then
script -c $0 /dev/null
exit 0
fi
export LD_LIBRARY_PATH=/usr/local/lib/opencog/modules
if [ $# -lt 3 ]
then
echo "Usage: ./run-multiple-terminals.sh <mode> <language> <db_name> [<username>] [<password>]"
exit 0
fi
# Get port number according to mode and language
source ./config/det-port-num.sh $1 $2
launcher=launch-cogserver.scm
# Start multiple sessions (use byobu so that the scroll bars actually work)
# Call launch-??.scm to start cogserver
byobu new-session -d -n 'cntl' '$SHELL'
case $# in
3)
byobu new-window -n 'cogsrv' "nice guile -l $launcher -- --mode $1 --lang $2 --db $3; $SHELL"
;;
4)
byobu new-window -n 'cogsrv' "nice guile -l $launcher -- --mode $1 --lang $2 --db $3 --user $4; $SHELL"
;;
*)
byobu new-window -n 'cogsrv' "nice guile -l $launcher -- --mode $1 --lang $2 --db $3 --user $4 --password $5; $SHELL"
;;
esac
sleep 2;
# Telnet window
tmux new-window -n 'telnet' "rlwrap telnet localhost $PORT; $SHELL"
# Parse
# ./text-process.sh
tmux new-window -n 'parse' '$SHELL'
# Spare
tmux new-window -n 'spare' '$SHELL'
# Fix the annoying byobu display
echo "tmux_left=\"session\"" > $HOME/.byobu/status
echo "tmux_right=\"load_average disk_io date time\"" >> $HOME/.byobu/status
tmux attach
echo "Started"