first fixes in the systemd/ area
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Sat, 26 May 2018 07:42:38 +0000 (09:42 +0200)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Sat, 26 May 2018 07:58:55 +0000 (09:58 +0200)
setup.py
sfa.spec
systemd/sfa-aggregate.service
systemd/sfa-db-init.sh
systemd/sfa-db.service
systemd/sfa-registry.service

index 770dace..b168ec7 100755 (executable)
--- a/setup.py
+++ b/setup.py
@@ -88,14 +88,6 @@ data_files = [
 ]
 
 
-initscripts = [ 'sfa' ]
-if not os.path.isfile('/etc/redhat-release'):
-    initscripts.append('functions.sfa')
-data_files.append(
-    ('/etc/init.d/',
-     [ "init.d/%s"%x for x in initscripts ]))
-
-
 services = ['sfa-db', 'sfa-aggregate', 'sfa-registry']
 data_files.append(
     ('/usr/lib/systemd/system',
@@ -122,8 +114,6 @@ if sys.argv[1] in ['uninstall', 'remove', 'delete', 'clean']:
     remove_dirs = ['/etc/sfa/', '/etc/sfatables'] + site_packages_path
     remove_bins = [ '/usr/bin/' + os.path.basename(bin) for bin in scripts ]
     remove_files = (remove_bins
-                    + ["/etc/init.d/{}}".format(x)
-                       for x in initscripts ]
                     + ["/usr/lib/systemd/system/{}".format(x)
                        for x in services])
 
index 71870ed..b778da7 100644 (file)
--- a/sfa.spec
+++ b/sfa.spec
@@ -150,7 +150,6 @@ make VERSIONTAG="%{version}-%{taglevel}" SCMURL="%{SCMURL}" install DESTDIR="$RP
 rm -rf $RPM_BUILD_ROOT
 
 %files
-/etc/init.d/sfa
 /usr/lib/systemd/system/*.service
 %{_bindir}/sfa-start.py*
 %{_bindir}/sfaadmin.py*
index 1174bb7..497c860 100644 (file)
@@ -1,12 +1,10 @@
-# this is meant to be installed under /etc/systemd/system
 [Unit]
 Description=SFA Aggregate Manager (AM)
+Requires=sfa-db
+After=sfa-db
 
 [Service]
-#Environment=PYTHONPATH=/root/nbhosting/nbhosting
 ExecStart=/bin/bash -c "/usr/bin/sfa-start.py -a"
-Requires=sfa-db
-After=sfa-db
 
 [Install]
 WantedBy=multi-user.target
index 1a030fd..f28d7bd 100755 (executable)
@@ -18,12 +18,6 @@ sfa_local_config=/etc/sfa/configs/site_config
 sfa_local_config_xml=/etc/sfa/configs/site_config.xml
 sfa_local_config_sh=/etc/sfa/sfa_config.sh
 
-# source shell config if present; might not be the very first time
-[ -f $sfa_local_config_sh ] && source $sfa_local_config_sh
-
-# Export so that we do not have to specify -p to psql invocations
-export PGPORT=$SFA_DB_PORT
-
 # Regenerate configuration files - almost verbatim from plc.init
 function reconfigure () {
 
@@ -108,7 +102,7 @@ function start () {
     echo "local all all trust" >> $pg_hba_conf
 
     # Disable access to our DB from all hosts
-    sed -i -e "/^host ${SFA_DB_NAME}/d' $pg_hba_conf
+    sed -i -e "/^host ${SFA_DB_NAME}/d" $pg_hba_conf
     # grant access
     {
         echo "host $SFA_DB_NAME $SFA_DB_USER 127.0.0.1/32 password"
@@ -145,4 +139,13 @@ function start () {
 
 }
 
+# source shell config if present
+# but it might not be present the very first time
+[ ! -f $sfa_local_config_sh ] && reconfigure
+
+source $sfa_local_config_sh
+
+# Export so that we do not have to specify -p to psql invocations
+export PGPORT=$SFA_DB_PORT
+
 start
index f2d7d2c..7ad798e 100644 (file)
@@ -1,6 +1,7 @@
 [Unit]
 Description=SFA Database service
-#After=network.target
+Requires=postgresql
+After=postgresql
 
 [Service]
 Type=oneshot
@@ -10,8 +11,6 @@ RemainAfterExit=true
 # that does not seem useful in our case
 ExecStop=/bin/true
 StandardOutput=journal
-Requires=postgresql
-After=postgresql
 
 [Install]
 WantedBy=multi-user.target
index fec12f5..e87af52 100644 (file)
@@ -1,12 +1,11 @@
 # this is meant to be installed under /etc/systemd/system
 [Unit]
 Description=SFA Registry Service
+Requires=sfa-db
+After=sfa-db
 
 [Service]
-#Environment=PYTHONPATH=/root/nbhosting/nbhosting
 ExecStart=/bin/bash -c "/usr/bin/sfa-start.py -r"
-Requires=sfa-db
-After=sfa-db
 
 [Install]
 WantedBy=multi-user.target