-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstartup_script.template
More file actions
47 lines (40 loc) · 1.56 KB
/
startup_script.template
File metadata and controls
47 lines (40 loc) · 1.56 KB
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
#!/bin/bash
# set hostname
echo REPL_HOSTNAME > /etc/hostname
echo "127.0.0.1 REPL_HOSTNAME" >> /etc/hosts
hostname -F /etc/hostname
export HOSTNAME=REPL_HOSTNAME
# deploy VPN setup
cd /etc/openvpn
wget http://REPL_DL_SERVER:1194/REPL_HOSTNAME.tgz
tar xzf REPL_HOSTNAME.tgz
/etc/init.d/openvpn restart
# create user mountpoint
mkdir /usr/local/drqueue/tmp/REPL_USERDIR
# wait until server is reachable
exval=1
while [ "$exval" -eq "1" ]
do
ping -c 1 REPL_MASTER 2>&1 >/dev/null
exval=$?
sleep 1
done
# mount shared storage
mount -t cifs -o rw,username=drqueue,password= //REPL_MASTER/tmp/REPL_USERDIR /usr/local/drqueue/tmp/REPL_USERDIR
mount -t cifs -o rw,username=drqueue,password= //REPL_MASTER/logs /usr/local/drqueue/logs
mount -t cifs -o rw,username=drqueue,password= //REPL_MASTER/security /usr/local/drqueue/ipython/profile_default/security
sleep 5
# startup DrQueueIPython
export DRQUEUE_ROOT="/usr/local/drqueue"
export IPYTHONDIR="/usr/local/drqueue/ipython"
export DRQUEUE_MASTER=REPL_MASTER
export DRQUEUE_SLAVE=`ip addr sho tun0 | grep inet | awk '{print $2}'`
export DRQUEUE_POOL=REPL_POOL
echo "export DRQUEUE_ROOT=\"$DRQUEUE_ROOT\"" >/home/drqueue/env
echo "export IPYTHONDIR=\"$IPYTHONDIR\"" >>/home/drqueue/env
echo "export DRQUEUE_MASTER=\"$DRQUEUE_MASTER\"" >>/home/drqueue/env
echo "export DRQUEUE_SLAVE=\"$DRQUEUE_SLAVE\"" >>/home/drqueue/env
echo "export DRQUEUE_POOL=\"$DRQUEUE_POOL\"" >>/home/drqueue/env
chmod +x /home/drqueue/env
# su -c "cd && . ./env && $DRQUEUE_ROOT/bin/slave.Linux.x86_64 &" drqueue
su -c "cd && . ./env && drqueue_slave.py &" drqueue