Skip to content

Commit 719e6b4

Browse files
committed
Add extra folder and httpd.sh init script
1 parent e4e7b51 commit 719e6b4

3 files changed

Lines changed: 129 additions & 2 deletions

File tree

ESSArch_TA/api/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ def get_uploaded_file(self):
9595
class Meta:
9696
abstract = True
9797

98-
from django.db import ProgrammingError
98+
from django.db import ProgrammingError, OperationalError
9999
from configuration.models import Path
100100

101101
# GateareUpload
102102
try:
103103
Reception_upload_root = Path.objects.get(entity='path_ingest_reception').value
104-
except (Path.DoesNotExist, ProgrammingError) as e:
104+
except (Path.DoesNotExist, ProgrammingError, OperationalError) as e:
105105
Reception_upload_root = settings.MEDIA_ROOT
106106

107107
def Reception_filename(instance, filename):

ESSArch_TA/extra/__init__.py

Whitespace-only changes.

ESSArch_TA/extra/httpd.sh

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#!/bin/bash
2+
#
3+
### BEGIN INIT INFO
4+
# Provides: httpd
5+
# Required-Start: $all
6+
# Required-Stop: $network $local_fs $remote_fs
7+
# Default-Start: 2 3 5
8+
# Default-Stop: 0 1 6
9+
# Short-Description: Apache httpd server daemon
10+
### END INIT INFO
11+
#
12+
# httpd Startup script for the Apache HTTP Server
13+
#
14+
# chkconfig: - 85 15
15+
# description: Apache is a World Wide Web server. It is used to serve \
16+
# HTML files and CGI.
17+
# processname: httpd
18+
19+
# Source function library.
20+
. /etc/rc.d/init.d/functions #SUSE11 comment out the this row
21+
22+
23+
# Start httpd in the en_US.UTF-8 locale by default.
24+
HTTPD_LANG=en_US.UTF-8
25+
26+
# This will prevent initlog from swallowing up a pass-phrase prompt if
27+
# mod_ssl needs a pass-phrase from the user.
28+
INITLOG_ARGS=""
29+
30+
# Set HTTPD=/usr/sbin/httpd.worker in /etc/sysconfig/httpd to use a server
31+
# with the thread-based "worker" MPM; BE WARNED that some modules may not
32+
# work correctly with a thread-based MPM; notably PHP will refuse to start.
33+
34+
# Path to the apachectl script, server binary, and short-form for messages.
35+
apachectl=/ESSArch/pd/apache/bin/apachectl
36+
httpd=/ESSArch/pd/apache/bin/httpd
37+
CONFFILE=/ESSArch/config/httpd.conf
38+
OPTIONS="-f ${CONFFILE}"
39+
prog=httpd
40+
pidfile=/var/run/httpd.pid
41+
lockfile=/var/lock/subsys/httpd
42+
RETVAL=0
43+
export PATH=$PATH:/usr/sbin:/ESSArch/pd/python/bin
44+
export LD_LIBRARY_PATH=/ESSArch/pd/python/lib:/ESSArch/pd/libxslt/lib:/ESSArch/pd/libxml/lib
45+
export PYTHONPATH=/ESSArch/pd/python/lib/python2.7/site-packages/ESSArch_EPP:/ESSArch/pd/python/lib/python2.7/site-packages/ESSArch_EPP/workers:/ESSArch/config
46+
export PYTHON_EGG_CACHE=/ESSArch/pd/.python-eggs
47+
48+
export LANG='en_US.UTF-8'
49+
export LC_ALL='en_US.UTF-8'
50+
51+
# The semantics of these two functions differ from the way apachectl does
52+
# things -- attempting to start while running is a failure, and shutdown
53+
# when not running is also a failure. So we just do it the way init scripts
54+
# are expected to behave here.
55+
start() {
56+
echo -n $"Starting $prog: "
57+
LANG=$HTTPD_LANG daemon --pidfile=$pidfile $httpd $OPTIONS
58+
#LANG=$HTTPD_LANG $httpd $OPTIONS #SUSE11
59+
RETVAL=$?
60+
echo
61+
[ $RETVAL = 0 ] && touch ${lockfile}
62+
return $RETVAL
63+
}
64+
65+
# When stopping httpd a delay of >10 second is required before SIGKILLing the
66+
# httpd parent; this gives enough time for the httpd parent to SIGKILL any
67+
# errant children.
68+
stop() {
69+
echo -n $"Stopping $prog: "
70+
#killproc -p ${pidfile} -d 10 $httpd
71+
killproc -d 10 $httpd
72+
#killproc -t 10 $httpd #SUSE11
73+
RETVAL=$?
74+
echo
75+
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
76+
}
77+
reload() {
78+
echo -n $"Reloading $prog: "
79+
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
80+
RETVAL=$?
81+
echo $"not reloading due to configuration syntax error"
82+
failure $"not reloading $httpd due to configuration syntax error"
83+
else
84+
#killproc -p ${pidfile} $httpd -HUP
85+
killproc $httpd -HUP
86+
RETVAL=$?
87+
fi
88+
echo
89+
}
90+
91+
# See how we were called.
92+
case "$1" in
93+
start)
94+
start
95+
;;
96+
stop)
97+
stop
98+
;;
99+
status)
100+
status -p ${pidfile} $httpd
101+
#status $httpd
102+
RETVAL=$?
103+
;;
104+
restart)
105+
stop
106+
start
107+
;;
108+
condrestart|try-restart)
109+
if status -p ${pidfile} $httpd >&/dev/null; then
110+
#if [ -f ${pidfile} ] ; then
111+
stop
112+
start
113+
fi
114+
;;
115+
force-reload|reload)
116+
reload
117+
;;
118+
graceful|help|configtest|fullstatus)
119+
$apachectl $@
120+
RETVAL=$?
121+
;;
122+
*)
123+
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
124+
exit 1
125+
esac
126+
127+
exit $RETVAL

0 commit comments

Comments
 (0)