7.19a: configuration with systemd
This commit is contained in:
parent
4be0b94e48
commit
46537f13c4
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "7.18"
|
||||
SCOVERSION = "7.19a"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
17
config/configure_systemd.sh
Executable file
17
config/configure_systemd.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Modify ScoDoc install tu use systemd
|
||||
# E. Viennet, 2020-12-04
|
||||
source config.sh
|
||||
source utils.sh
|
||||
|
||||
check_uid_root $0
|
||||
|
||||
echo 'Installation du demarrage automatique de ScoDoc (systemd)'
|
||||
cp $SCODOC_DIR/config/etc/scodoc.service /etc/systemd/system
|
||||
systemctl enable scodoc.service
|
||||
|
||||
echo "A partir de maintenant, utiliser"
|
||||
echo " pour demarrer: systemctl start scodoc"
|
||||
echo " pour arreter : systemctl stop scodoc"
|
||||
|
@ -41,7 +41,8 @@ cfg_pathname="${SCODOC_VAR_DIR}/config/depts/$DEPT".cfg
|
||||
if [ -e $cfg_pathname ]
|
||||
then
|
||||
# arret de ScoDoc
|
||||
/etc/init.d/scodoc stop
|
||||
scodocctl stop
|
||||
|
||||
# suppression de la base postgres
|
||||
db_name=$(cat $cfg_pathname | sed '/^dbname=*/!d; s///;q')
|
||||
echo "suppression de la base postgres $db_name"
|
||||
@ -53,7 +54,7 @@ then
|
||||
read ans
|
||||
if [ "$(norm_ans "$ans")" = 'Y' ]
|
||||
then
|
||||
/etc/init.d/scodoc start
|
||||
scodocctl start
|
||||
fi
|
||||
exit 0
|
||||
else
|
||||
|
@ -19,7 +19,7 @@ echo "Changing to directory " $SCODOC_DIR/config
|
||||
cd $SCODOC_DIR/config
|
||||
|
||||
echo "Stopping ScoDoc..."
|
||||
/etc/init.d/scodoc stop
|
||||
scodocctl stop
|
||||
|
||||
# DROITS
|
||||
echo -n "Verification des droits: proprietaire www-data ? (y/n) [y] "
|
||||
|
@ -219,9 +219,10 @@ echo -n "Voulez vous installer le service scodoc ? (y/n) [y] "
|
||||
read ans
|
||||
if [ "$(norm_ans "$ans")" != 'N' ]
|
||||
then
|
||||
echo 'Installation du demarrage automatique de ScoDoc'
|
||||
cp $SCODOC_DIR/config/etc/scodoc /etc/init.d/
|
||||
update-rc.d scodoc defaults
|
||||
# ScoDoc 7.19+ uses systemd
|
||||
echo 'Installation du demarrage automatique de ScoDoc (systemd)'
|
||||
cp $SCODOC_DIR/config/etc/scodoc.service /etc/systemd/system
|
||||
systemctl enable scodoc.service
|
||||
fi
|
||||
|
||||
|
||||
|
@ -71,7 +71,7 @@ fi
|
||||
|
||||
echo "Source is $SRC"
|
||||
echo "Stopping ScoDoc..."
|
||||
/etc/init.d/scodoc stop
|
||||
scodocctl stop
|
||||
|
||||
# Erase all postgres databases and load data
|
||||
chmod a+rx "$SRC"
|
||||
@ -141,5 +141,4 @@ cd $SCODOC_DIR/config
|
||||
|
||||
#
|
||||
echo
|
||||
echo "Ok. Run \"/etc/init.d/scodoc start\" to start ScoDoc."
|
||||
|
||||
scodocctl start
|
@ -8,6 +8,7 @@
|
||||
#
|
||||
# E. Viennet, Sept 2011, Aug 2020
|
||||
#
|
||||
source utils.sh
|
||||
|
||||
# Destination directory
|
||||
if [ ! $# -eq 1 ]
|
||||
@ -37,7 +38,7 @@ source utils.sh
|
||||
check_uid_root $0
|
||||
|
||||
echo "Stopping ScoDoc..."
|
||||
/etc/init.d/scodoc stop
|
||||
scodocctl stop
|
||||
|
||||
# Dump all postgres databases
|
||||
echo "Dumping SQL database..."
|
||||
|
@ -28,8 +28,7 @@ then
|
||||
(cd "$SCODOC_DIR"; find . -name .svn -type d -exec dirname {} \; | xargs svn upgrade)
|
||||
fi
|
||||
|
||||
echo "Stopping ScoDoc..."
|
||||
/etc/init.d/scodoc stop
|
||||
scodocctl stop
|
||||
|
||||
echo
|
||||
echo "Using SVN to update $SCODOC_DIR..."
|
||||
@ -133,7 +132,6 @@ su -c "$SCODOC_DIR/config/postupgrade-db.py" $POSTGRES_USER
|
||||
|
||||
#
|
||||
echo
|
||||
echo "Starting ScoDoc..."
|
||||
/etc/init.d/scodoc start
|
||||
scodocctl start
|
||||
|
||||
|
||||
|
@ -29,6 +29,25 @@ terminate() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Start/stop scodoc, using sysv or systemd
|
||||
scodocctl() {
|
||||
if [ "$1" = "start" ]; then
|
||||
echo "Starting ScoDoc..."
|
||||
elif [ "$1" = "stop" ]; then
|
||||
echo "Stopping ScoDoc"
|
||||
else
|
||||
echo "Error: invalid argument for scodocctl"
|
||||
exit 1
|
||||
fi
|
||||
if [ -e /etc/systemd/system/scodoc.service ]
|
||||
then
|
||||
systemctl $1 scodoc
|
||||
else
|
||||
echo "(using legacy SystemV)"
|
||||
/etc/init.d/scodoc $1
|
||||
fi
|
||||
}
|
||||
|
||||
# --- Ensure postgres user www-data exists
|
||||
init_postgres_user() { # run as root
|
||||
if [ -z $(echo "select usename from pg_user;" | su -c "$PSQL -d template1 -p $POSTGRES_PORT" $POSTGRES_SUPERUSER | grep $POSTGRES_USER) ]
|
||||
@ -43,7 +62,7 @@ init_postgres_user() { # run as root
|
||||
# XXX inutilise
|
||||
gen_passwd() {
|
||||
PASSWORD_LENGTH="8"
|
||||
ALLOWABLE_ASCII="~@#$%^&*()_+=-?><0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
ALLOWABLE_ASCII="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz@#$%^&*()_+=-?><"
|
||||
SEED=$(head -c4 /dev/urandom | od -t u4 | awk '{ print $2 }')
|
||||
RANDOM=$SEED
|
||||
n=1
|
||||
|
@ -15,7 +15,7 @@ Le copier sur la machine destination.
|
||||
2) Sur la machine destination:
|
||||
|
||||
Avant toute chose, stopper scodoc:
|
||||
/etc/init.d/scodoc stop
|
||||
/etc/init.d/scodoc stop (ou systemctl stop scodoc))
|
||||
|
||||
1.1) Supprimer toutes les bases ScoDoc existantes s'il y en a:
|
||||
su postgres
|
||||
@ -42,7 +42,7 @@ done
|
||||
|
||||
|
||||
Puis redemarrer ScoDoc:
|
||||
en tant que root: /etc/init.d/scodoc start
|
||||
en tant que root: /etc/init.d/scodoc start (ou systemctl start scodoc)
|
||||
|
||||
NB: si la version des sources a changée, lancer imperativement le script de mise a jour
|
||||
avant de redemarrer scodoc, afin qu'il change si besoin la base de donnees:
|
||||
|
@ -12,7 +12,7 @@
|
||||
#
|
||||
# Note: pour restaurer un backup (en supprimant la base existante !):
|
||||
#
|
||||
# 0- Arreter scodoc: /etc/init.d/scodoc stop
|
||||
# 0- Arreter scodoc: /etc/init.d/scodoc stop (ou systemctl stop scodoc)
|
||||
#
|
||||
# Puis en tant qu'utilisateur postgres: su postgres
|
||||
# 1- supprimer la base existante si elle existe: dropdb SCOXXX
|
||||
@ -23,7 +23,7 @@
|
||||
# 3- pg_restore -d SCOXXX SCOXXX_pgdump
|
||||
#
|
||||
# Revenir a l'utilisateur root: exit
|
||||
# 4- Relancer scodoc: /etc/init.d/scodoc start
|
||||
# 4- Relancer scodoc: /etc/init.d/scodoc start (ou systemctl start scodoc)
|
||||
|
||||
DBNAME=$1
|
||||
DUMPBASE="$DBNAME"-BACKUPS
|
||||
|
Loading…
Reference in New Issue
Block a user