git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
do not rely on /etc/myplc-release to start or stop postgresql
[sfa.git]
/
init.d
/
sfa
diff --git
a/init.d/sfa
b/init.d/sfa
index
ae4aa9c
..
e3b80f9
100755
(executable)
--- a/
init.d/sfa
+++ b/
init.d/sfa
@@
-36,6
+36,7
@@
function debian_get_postgresql_versions () {
}
####################
}
####################
+POSTGRESQL_STARTED=/etc/sfa/postgresql-started
if [ -f /etc/redhat-release ] ; then
# source function library
. /etc/init.d/functions
if [ -f /etc/redhat-release ] ; then
# source function library
. /etc/init.d/functions
@@
-233,9
+234,13
@@
function db_start () {
######## Start up the server
# not too nice, but.. when co-located with myplc we'll let it start/stop postgresql
######## Start up the server
# not too nice, but.. when co-located with myplc we'll let it start/stop postgresql
- if [ ! -f /etc/myplc-release ] ; then
- echo STARTING...
+ if [ ! postgresql_check ] ; then
service postgresql start >& /dev/null
service postgresql start >& /dev/null
+ MESSAGE=$"Starting PostgreSQL server"
+ echo -n "$MESSAGE"
+ [ "$ERRORS" == 0 ] && success "$MESSAGE" || failure "$MESSAGE" ; echo
+ # best-effort to make sure we turn it back off when running stop
+ touch $POSTGRESQL_STARTED
fi
postgresql_check
check
fi
postgresql_check
check
@@
-270,12
+275,13
@@
function db_stop () {
[ "$SFA_DB_ENABLED" == 1 -o "$SFA_DB_ENABLED" == True ] || return
# not too nice, but.. when co-located with myplc we'll let it start/stop postgresql
[ "$SFA_DB_ENABLED" == 1 -o "$SFA_DB_ENABLED" == True ] || return
# not too nice, but.. when co-located with myplc we'll let it start/stop postgresql
- if [
! -f /etc/myplc-release
] ; then
+ if [
-f $POSTGRESQL_STARTED
] ; then
service postgresql stop >& /dev/null
check
MESSAGE=$"Stopping PostgreSQL server"
echo -n "$MESSAGE"
[ "$ERRORS" == 0 ] && success "$MESSAGE" || failure "$MESSAGE" ; echo
service postgresql stop >& /dev/null
check
MESSAGE=$"Stopping PostgreSQL server"
echo -n "$MESSAGE"
[ "$ERRORS" == 0 ] && success "$MESSAGE" || failure "$MESSAGE" ; echo
+ rm -f $POSTGRESQL_STARTED
fi
}
fi
}