Zhang Huangbin avatar Zhang Huangbin committed 65f00c8

Use systemctl to enable/disable service on openSUSE.

Comments (0)

Files changed (5)

iRedMail/conf/core

     done
 }
 
+enable_service_suse()
+{
+    services="$@"
+    for i in $services; do
+        if [ -x /etc/init.d/$i ]; then
+            ECHO_DEBUG "Enable service: $i."
+            systemctl enable ${i}.service
+        fi
+    done
+}
+
+disable_service_suse()
+{
+    services="$@"
+    for i in $services; do
+        if [ -x /etc/init.d/$i ]; then
+            ECHO_DEBUG "Disable service: $i."
+            systemctl disable ${i}.service >/dev/null
+        fi
+    done
+}
+
 enable_service_debian()
 {
     services="$@"

iRedMail/conf/global

     export LIST_FILES_IN_PKG='rpm -ql'
 
     # Service control.
-    export enable_service='enable_service_rh'
-    export disable_service='disable_service_rh'
+    export enable_service='enable_service_suse'
+    export disable_service='disable_service_suse'
 
     # Syslog config file: syslog.
     export SYSLOG_CONF='/etc/rsyslog.conf'

iRedMail/functions/cleanup.sh

     [ X"${BACKEND}" == X'PGSQL' ] && check_status_before_run cleanup_pgsql_force_password
 
     # Start Dovecot to deliver emails.
-    ${DIR_RC_SCRIPTS}/${DOVECOT_RC_SCRIPT_NAME} restart >/dev/null 2>&1
+    ${DIR_RC_SCRIPTS}/${DOVECOT_RC_SCRIPT_NAME} restart &>/dev/null
+    sleep 3
 
     # Send tip file to the mail server admin and/or first mail user.
     tip_recipient="${FIRST_USER}@${FIRST_DOMAIN}"

iRedMail/functions/cluebringer.sh

     #
     # Configure '[database]' section.
     #
+    perl -pi -e 's#^(bypass_mode=).*#${1}pass#' ${CLUEBRINGER_CONF}
+
     # DSN
     if [ X"${BACKEND}" == X"OPENLDAP" -o X"${BACKEND}" == X"MYSQL" ]; then
         perl -pi -e 's/^(#*)(DSN=DBI:mysql:).*/${2}host=$ENV{MYSQL_SERVER};database=$ENV{CLUEBRINGER_DB_NAME};user=$ENV{CLUEBRINGER_DB_USER};password=$ENV{CLUEBRINGER_DB_PASSWD}/' ${CLUEBRINGER_CONF}

iRedMail/functions/iredapd.sh

     chmod +x ${IREDAPD_ROOT_DIR}/iredapd/src/iredapd.py
 
     ECHO_DEBUG "Make iredapd start after system startup."
-    eval ${enable_service} iredapd >/dev/null
+    eval ${enable_service} iredapd &>/dev/null
     export ENABLED_SERVICES="${ENABLED_SERVICES} iredapd"
 
     # Set file permission.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.