Browse Source

filtron.sh: add 'install rules' command

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Markus Heiser 5 years ago
parent
commit
e6bf2038c3
2 changed files with 18 additions and 2 deletions
  1. 3 1
      utils/filtron.sh
  2. 15 1
      utils/lib.sh

+ 3 - 1
utils/filtron.sh

@@ -58,7 +58,7 @@ usage() {
 usage::
 usage::
 
 
   $(basename "$0") shell
   $(basename "$0") shell
-  $(basename "$0") install    [all|user]
+  $(basename "$0") install    [all|user|rules]
   $(basename "$0") update     [filtron]
   $(basename "$0") update     [filtron]
   $(basename "$0") remove     [all]
   $(basename "$0") remove     [all]
   $(basename "$0") activate   [service]
   $(basename "$0") activate   [service]
@@ -72,6 +72,7 @@ shell
 install / remove
 install / remove
   :all:        complete setup of filtron service
   :all:        complete setup of filtron service
   :user:       add/remove service user '$SERVICE_USER' ($SERVICE_HOME)
   :user:       add/remove service user '$SERVICE_USER' ($SERVICE_HOME)
+  :rules:      reinstall filtron rules $FILTRON_RULES
 update filtron
 update filtron
   Update filtron installation ($SERVICE_HOME)
   Update filtron installation ($SERVICE_HOME)
 activate service
 activate service
@@ -133,6 +134,7 @@ main() {
                     rst_title "Re-Install filtron rules"
                     rst_title "Re-Install filtron rules"
                     echo
                     echo
                     install_template --no-eval "$FILTRON_RULES" root root 644
                     install_template --no-eval "$FILTRON_RULES" root root 644
+                    systemd_restart_service "${SERVICE_NAME}"
                     ;;
                     ;;
                 *) usage "$_usage"; exit 42;;
                 *) usage "$_usage"; exit 42;;
             esac ;;
             esac ;;

+ 15 - 1
utils/lib.sh

@@ -569,7 +569,7 @@ systemd_remove_service() {
 
 
 systemd_activate_service() {
 systemd_activate_service() {
 
 
-    # usage:  systemd_activate_service "${SERVICE_NAME}"w
+    # usage:  systemd_activate_service "${SERVICE_NAME}"
 
 
     rst_title "Activate ${1} (service)" section
     rst_title "Activate ${1} (service)" section
     echo
     echo
@@ -594,6 +594,20 @@ systemctl disable ${1}.service
 EOF
 EOF
 }
 }
 
 
+systemd_restart_service() {
+
+    # usage:  systemd_restart_service "${SERVICE_NAME}"
+
+    rst_title "Restart ${1} (service)" section
+    echo
+    tee_stderr <<EOF | bash 2>&1
+systemctl restart ${1}.service
+EOF
+    tee_stderr <<EOF | bash 2>&1
+systemctl status --no-pager ${1}.service
+EOF
+}
+
 
 
 # Apache
 # Apache
 # ------
 # ------