Support reloading with SIGURG in addition to SIGHUP
This commit is contained in:
parent
cdc60ee231
commit
4a0de95ad5
@ -0,0 +1,78 @@
|
|||||||
|
From 630b24112fbd87c0dd020795a221fefc8840630a Mon Sep 17 00:00:00 2001
|
||||||
|
From: YoruStar <524413304@qq.com>
|
||||||
|
Date: Wed, 29 Mar 2023 15:58:58 +0800
|
||||||
|
Subject: [PATCH] Support reloading with SIGURG in addition to SIGHUP
|
||||||
|
|
||||||
|
And use that with the systemd unit to handle the reload.
|
||||||
|
|
||||||
|
Conflict:NA
|
||||||
|
Reference:https://github.com/cronie-crond/cronie/commit/630b24112fbd87c0dd020795a221fefc8840630a
|
||||||
|
---
|
||||||
|
contrib/cronie.systemd | 2 +-
|
||||||
|
src/cron.c | 12 ++++++++++--
|
||||||
|
2 files changed, 11 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/contrib/cronie.systemd b/contrib/cronie.systemd
|
||||||
|
index 19f2a98..8317367 100644
|
||||||
|
--- a/contrib/cronie.systemd
|
||||||
|
+++ b/contrib/cronie.systemd
|
||||||
|
@@ -5,7 +5,7 @@ After=auditd.service nss-user-lookup.target systemd-user-sessions.service time-s
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=/etc/sysconfig/crond
|
||||||
|
ExecStart=/usr/sbin/crond -n $CRONDARGS
|
||||||
|
-ExecReload=/bin/kill -HUP $MAINPID
|
||||||
|
+ExecReload=/bin/kill -URG $MAINPID
|
||||||
|
KillMode=process
|
||||||
|
Restart=on-failure
|
||||||
|
RestartSec=30s
|
||||||
|
diff --git a/src/cron.c b/src/cron.c
|
||||||
|
index 1ff19e3..e4e119d 100644
|
||||||
|
--- a/src/cron.c
|
||||||
|
+++ b/src/cron.c
|
||||||
|
@@ -66,10 +66,11 @@ set_time(int),
|
||||||
|
cron_sleep(int, cron_db *),
|
||||||
|
sigchld_handler(int),
|
||||||
|
sighup_handler(int ATTRIBUTE_UNUSED),
|
||||||
|
+sigurg_handler(int ATTRIBUTE_UNUSED),
|
||||||
|
sigchld_reaper(void),
|
||||||
|
sigintterm_handler(int ATTRIBUTE_UNUSED), parse_args(int c, char *v[]);
|
||||||
|
|
||||||
|
-static volatile sig_atomic_t got_sighup, got_sigchld, got_sigintterm;
|
||||||
|
+static volatile sig_atomic_t got_sighup, got_sigchld, got_sigintterm, got_sigurg;
|
||||||
|
static int timeRunning, virtualTime, clockTime;
|
||||||
|
static long GMToff;
|
||||||
|
static int DisableInotify;
|
||||||
|
@@ -151,8 +152,9 @@ void set_cron_watched(int fd) {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void handle_signals(cron_db * database) {
|
||||||
|
- if (got_sighup) {
|
||||||
|
+ if (got_sighup || got_sigurg) {
|
||||||
|
got_sighup = 0;
|
||||||
|
+ got_sigurg = 0;
|
||||||
|
#if defined WITH_INOTIFY
|
||||||
|
/* watches must be reinstated on reload */
|
||||||
|
if (inotify_enabled && (EnableClustering != 1)) {
|
||||||
|
@@ -243,6 +245,8 @@ int main(int argc, char *argv[]) {
|
||||||
|
sact.sa_handler = sigintterm_handler;
|
||||||
|
(void) sigaction(SIGINT, &sact, NULL);
|
||||||
|
(void) sigaction(SIGTERM, &sact, NULL);
|
||||||
|
+ sact.sa_handler = sigurg_handler;
|
||||||
|
+ (void) sigaction(SIGURG, &sact, NULL);
|
||||||
|
|
||||||
|
acquire_daemonlock(0);
|
||||||
|
set_cron_uid();
|
||||||
|
@@ -664,6 +668,10 @@ static void sigintterm_handler(int x ATTRIBUTE_UNUSED) {
|
||||||
|
got_sigintterm = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static void sigurg_handler(int x ATTRIBUTE_UNUSED) {
|
||||||
|
+ got_sigurg = 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static void sigchld_reaper(void) {
|
||||||
|
WAIT_T waiter;
|
||||||
|
PID_T pid;
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
10
cronie.spec
10
cronie.spec
@ -1,6 +1,6 @@
|
|||||||
Name: cronie
|
Name: cronie
|
||||||
Version: 1.6.1
|
Version: 1.6.1
|
||||||
Release: 3
|
Release: 4
|
||||||
Summary: Standard UNIX daemon crond
|
Summary: Standard UNIX daemon crond
|
||||||
License: GPLv2+ and ISC
|
License: GPLv2+ and ISC
|
||||||
URL: https://github.com/cronie-crond/cronie
|
URL: https://github.com/cronie-crond/cronie
|
||||||
@ -9,6 +9,8 @@ Source0: https://github.com/cronie-crond/cronie/releases/download/cronie-%{vers
|
|||||||
|
|
||||||
Patch0: bugfix-cronie-systemd-alias.patch
|
Patch0: bugfix-cronie-systemd-alias.patch
|
||||||
|
|
||||||
|
Patch6000: backport-Support-reloading-with-SIGURG-in-addition-to-SIGHUP.patch
|
||||||
|
|
||||||
BuildRequires: automake
|
BuildRequires: automake
|
||||||
BuildRequires: gcc systemd libselinux-devel pam-devel audit-libs-devel
|
BuildRequires: gcc systemd libselinux-devel pam-devel audit-libs-devel
|
||||||
|
|
||||||
@ -118,6 +120,12 @@ systemctl try-restart crond.service >/dev/null 2>&1 || :
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jun 15 2023 wangyuhang <wangyuhang27@huawei.com> - 1.6.1-4
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:Support reloading with SIGURG in addition to SIGHUP
|
||||||
|
|
||||||
* Wed Feb 15 2023 wangjunqi <wangjunqi@kylinos.cn> - 1.6.1-3
|
* Wed Feb 15 2023 wangjunqi <wangjunqi@kylinos.cn> - 1.6.1-3
|
||||||
- replace 'make check' with '%make_build check'
|
- replace 'make check' with '%make_build check'
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user