From e9864875794d4b2ee6a29c0ca0e506fcf77f2093 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Thu, 29 May 2025 19:32:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0omc=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E7=9A=84systemd=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- linux/lib/systemd/system/omc-exec.service | 9 +++++++++ linux/usr/local/etc/omc/script/omc_exec.sh | 1 + pkg/deb/DEBIAN/postinst | 8 ++++---- pkg/rpm/SPECS/omc.spec | 10 +++++----- 4 files changed, 19 insertions(+), 9 deletions(-) create mode 100644 linux/lib/systemd/system/omc-exec.service create mode 100644 linux/usr/local/etc/omc/script/omc_exec.sh diff --git a/linux/lib/systemd/system/omc-exec.service b/linux/lib/systemd/system/omc-exec.service new file mode 100644 index 0000000..1b8f1bb --- /dev/null +++ b/linux/lib/systemd/system/omc-exec.service @@ -0,0 +1,9 @@ +[Unit] +Description=omc execute script daemon + +[Service] +ExecStart=/usr/local/etc/omc/script/omc_exec.sh +Type=oneshot + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/linux/usr/local/etc/omc/script/omc_exec.sh b/linux/usr/local/etc/omc/script/omc_exec.sh new file mode 100644 index 0000000..a9bf588 --- /dev/null +++ b/linux/usr/local/etc/omc/script/omc_exec.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/pkg/deb/DEBIAN/postinst b/pkg/deb/DEBIAN/postinst index 035d371..0d30c6a 100644 --- a/pkg/deb/DEBIAN/postinst +++ b/pkg/deb/DEBIAN/postinst @@ -5,8 +5,8 @@ RootDir=/usr/local/etc/omc # Perform post-installation configuration echo "" echo "Output: $RootDir" -echo "Please Run:" -echo " sudo systemctl start|stop|status|restart omc.service" +echo "Service:" +echo " sudo systemctl [start|stop|status|restart] omc.service" echo "" # Check if this is the first installation or upgrade @@ -55,7 +55,7 @@ else fi systemctl daemon-reload - systemctl start omc.service - systemctl start sshsvc.service + systemctl restart omc.service + systemctl restart sshsvc.service fi echo "" diff --git a/pkg/rpm/SPECS/omc.spec b/pkg/rpm/SPECS/omc.spec index 9860b0e..3619ecd 100644 --- a/pkg/rpm/SPECS/omc.spec +++ b/pkg/rpm/SPECS/omc.spec @@ -32,9 +32,9 @@ RootDir=/usr/local/etc/omc # Perform post-installation configuration echo "" echo "Output: $RootDir" -echo "Please Run:" -echo " sudo systemctl start|stop|status|restart omc.service" -echo "Setting Firewall:" +echo "Service:" +echo " sudo systemctl [start|stop|status|restart] omc.service" +echo "Firewall:" echo " add: " echo " firewall-cmd --zone=public --add-port=80/tcp --permanent && firewall-cmd --reload" echo " remove: " @@ -87,8 +87,8 @@ else fi systemctl daemon-reload - systemctl start omc.service - systemctl start sshsvc.service + systemctl restart omc.service + systemctl restart sshsvc.service fi echo ""