forked from marius311/boinc-server-docker
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmakeproject-step3.sh
More file actions
executable file
·44 lines (33 loc) · 1.28 KB
/
makeproject-step3.sh
File metadata and controls
executable file
·44 lines (33 loc) · 1.28 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
#!/bin/bash
#set -e
cd $PROJECT_ROOT
# gives $BOINC_USER permission to run Docker commands
DOCKER_GID=$(stat -c '%g' /var/run/docker.sock)
addgroup -gid ${DOCKER_GID} docker
addgroup ${BOINC_USER} docker
# Apache needs +x to serve this directory
chmod g+x $HOME
while :
do
# the first time we build a project, we wait here until the makeproject-step2.sh
# script is done
while [ ! -f .built_${PROJECT} ] ; do sleep 1; done
echo "Finalizing project startup..."
ln -sf ${PROJECT_ROOT}/${PROJECT}.httpd.conf /etc/apache2/sites-enabled/
# if apache already booted up, restart it so as to reread the httpd.conf
# file (it could be close as both this script and apache are started at
# the same time by supervisord, but we need this just in case)
if ps -C apache2 ; then
apache2ctl -k graceful
fi
# start daemons as $BOINC_USER
su $BOINC_USER -c """
bin/start
(echo "PATH=$PATH"; echo "SHELL=/bin/bash"; cat *.cronjob) | crontab
"""
echo "Project startup complete."
# subsequent times we build a project (such as after a PROJECT change), we
# go through once then possibly go through again to avoid a race condition
# with makeproject-step2.sh
inotifywait -e attrib .built_${PROJECT}
done