-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
56 lines (42 loc) · 1.31 KB
/
init.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
#!/bin/bash
# $1: simulation $2: icub user, $3: icub psw, $4: icub host, $5: yarpmanager apps folder, $6 UID
env_robot()
{
USER=$1
PASS=$2
HOST=$3
APPS=$4
SSH_ASKPASS_SCRIPT=/home/docky/ssh-pass.sh
cat > ${SSH_ASKPASS_SCRIPT} <<EOL
#!/bin/bash
echo "${PASS}"
EOL
chmod u+x ${SSH_ASKPASS_SCRIPT}
export SSH_ASKPASS=${SSH_ASKPASS_SCRIPT}
cat /dev/zero | ssh-keygen -t rsa
setsid ssh-copy-id -oStrictHostKeyChecking=no -f ${USER}@${HOST}
sleep 1
yarpserver --write &
sleep 3
SSH_ASKPASS=${SSH_ASKPASS_SCRIPT} setsid ssh -oStrictHostKeyChecking=no ${USER}@${HOST} "yarprun --server /pc104 --log &" &
yarprun --server /root --log &
yarpmanager --apppath ${APPS}/applications/ --from ${APPS}/cluster-config.xml
SSH_ASKPASS=${SSH_ASKPASS_SCRIPT} setsid ssh -oStrictHostKeyChecking=no ${USER}@${HOST} "kill -9 \$(ps -aux | grep yarprun | awk '{print \$2}')"
SSH_ASKPASS=${SSH_ASKPASS_SCRIPT} setsid ssh -oStrictHostKeyChecking=no ${USER}@${HOST} "kill -9 \$(ps -aux | grep yarpdev | awk '{print \$2}')"
}
env_sim()
{
APPS=$1
export YARP_FORWARD_LOG_ENABLE=1
yarpserver --write &
sleep 2
yarprun --server /root --log &
yarpmanager --apppath ${APPS}/applications/ --from ${APPS}/cluster-config.xml
}
if [ "$ICUB_SIMULATION" = true ]
then
env_sim "$ICUB_APPS"
else
env_robot "$ICUB_USER" "$ICUB_PSW" "$ICUB_HOST" "$ICUB_APPS"
fi
exit