]> granicus.if.org Git - sysstat/commitdiff
configure: Add new option "--enable-use-crond"
authorSebastien GODARD <sysstat@users.noreply.github.com>
Sun, 10 May 2020 08:57:53 +0000 (10:57 +0200)
committerSebastien GODARD <sysstat@users.noreply.github.com>
Sun, 10 May 2020 08:57:53 +0000 (10:57 +0200)
Add a new option to configuration script to tell it to use the standard
cron daemon (and the SysV standard files in /etc/rc.d/) even if systemd
is installed.
I have added this option because systemd seems currently broken on my
F32 distro.

Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
Makefile.in
build/use-crond [new file with mode: 0644]
configure
configure.in
iconfig

index 915e02ad11176de1a44982fb27a3a8638192591f..8a8778f6d450062668776ddc2858247967cac6fe 100644 (file)
@@ -153,6 +153,13 @@ endif
 SYSTEMCTL = @SYSTEMCTL@
 SYSTEMD_UNIT_DIR = @SYSTEMD_UNIT_DIR@
 
+ifndef USE_CROND
+USE_CROND = @USE_CROND@
+endif
+ifeq ($(USE_CROND),y)
+SYSTEMD_UNIT_DIR =
+endif
+
 # Run-command directories
 ifndef RC_DIR
 RC_DIR = @RC_DIR@
@@ -515,7 +522,7 @@ endif
                fi \
        fi
 ifeq ($(COPY_ONLY),n)
-       if [ -x "$(SYSTEMCTL)" ]; then \
+       if [ -n "$(SYSTEMD_UNIT_DIR)" -a -x "$(SYSTEMCTL)" ]; then \
                $(SYSTEMCTL) enable sysstat.service; \
        fi
 endif
@@ -595,17 +602,17 @@ endif
 
 uninstall_all: uninstall_base
 ifeq ($(COPY_ONLY),n)
-       if [ -z "$(SYSTEMD_UNIT_DIR)" -o ! -d $(DESTDIR)$(SYSTEMD_UNIT_DIR) ]; then \
-               -su $(CRON_OWNER) -c "crontab -l > /tmp/crontab-$(CRON_OWNER).old" ; \
-               -$(CP) -a /tmp/crontab-$(CRON_OWNER).old ./crontab-$(CRON_OWNER).`date '+%Y%m%d.%H%M%S'`.old ; \
-               @echo "USER'S CRONTAB SAVED IN CURRENT DIRECTORY (USING .old SUFFIX)." ; \
-               -su $(CRON_OWNER) -c "crontab -r" ; \
+       -if [ -z "$(SYSTEMD_UNIT_DIR)" -o ! -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \
+               su $(CRON_OWNER) -c "crontab -l > /tmp/crontab-$(CRON_OWNER).old" ; \
+               $(CP) -a /tmp/crontab-$(CRON_OWNER).old ./crontab-$(CRON_OWNER).`date '+%Y%m%d.%H%M%S'`.old ; \
+               echo "USER'S CRONTAB SAVED IN CURRENT DIRECTORY (USING .old SUFFIX)." ; \
+               su $(CRON_OWNER) -c "crontab -r" ; \
        fi
-       if [ -x $(SYSTEMCTL) ]; then \
+       -if [ -n "$(SYSTEMD_UNIT_DIR)" -a -x "$(SYSTEMCTL)" ]; then \
                $(SYSTEMCTL) disable sysstat.service; \
        fi
 endif
-       if [ -n "$(SYSTEMD_UNIT_DIR)" -a -d $(DESTDIR)$(SYSTEMD_UNIT_DIR) ]; then \
+       if [ -n "$(SYSTEMD_UNIT_DIR)" -a -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \
                rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysstat.service; \
                rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysstat-collect.service; \
                rm -f $(DESTDIR)$(SYSTEMD_UNIT_DIR)/sysstat-collect.timer; \
diff --git a/build/use-crond b/build/use-crond
new file mode 100644 (file)
index 0000000..8ac5941
--- /dev/null
@@ -0,0 +1,4 @@
+By default sysstat uses systemd if available to start
+the sa1 (the data collector) and sa2 scripts periodically.
+Answer y if you want to use the standard cron daemon instead.
+Default answer is n (no).
index 3e958ffc06d7e46a34389eaa734af6c9c545a42d..da584a06be59a258b6fbca439990b8a1b63ff78d 100755 (executable)
--- a/configure
+++ b/configure
@@ -637,6 +637,7 @@ COPY_ONLY
 SADC_OPT
 sadc_options
 cron_interval
+USE_CROND
 cron_owner
 INSTALL_CRON
 CLEAN_SA_DIR
@@ -752,6 +753,7 @@ enable_file_attr
 enable_compress_manpg
 enable_clean_sa_dir
 enable_install_cron
+enable_use_crond
 enable_collect_all
 enable_copy_only
 enable_documentation
@@ -1396,6 +1398,7 @@ Optional Features:
   --enable-compress-manpg compress sysstat manual pages
   --enable-clean-sa-dir   clean system activity directory
   --enable-install-cron   install a crontab to start sar
+  --enable-use-crond      use standard cron daemon
   --enable-collect-all    collect all possible activities
   --enable-copy-only      only copy files when installing
   --disable-documentation do not install documentation
@@ -5238,6 +5241,7 @@ echo .
 #  --disable-pcp           do not link against PCP libraries even if available
 #  --disable-stripping     do not strip object files
 #  --enable-copy-only      only copy files when installing sysstat
+#  --enable-use-crond      use standard cron daemon
 #
 # Some influential environment variables:
 #  rcdir         directory where startup scripts are installed
@@ -5673,6 +5677,26 @@ $as_echo "$CRON_OWNER" >&6; }
       REM_CHOWN=$CHOWN
    fi
 
+#  Check whether we should use the standard cron daemon
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we should use the standard cron daemon" >&5
+$as_echo_n "checking whether we should use the standard cron daemon... " >&6; }
+   # Check whether --enable-use-crond was given.
+if test "${enable_use_crond+set}" = set; then :
+  enableval=$enable_use_crond; UCROND=$enableval
+else
+  UCROND=no
+fi
+
+   if test $UCROND != "yes"; then
+      USE_CROND=n
+      UCROND=no
+   else
+      USE_CROND=y
+   fi
+   { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UCROND" >&5
+$as_echo "$UCROND" >&6; }
+
+
 #  Crontab interval
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking crontab interval" >&5
 $as_echo_n "checking crontab interval... " >&6; }
@@ -5768,7 +5792,7 @@ else
   AUX_DOC=yes
 fi
 
-if  test  $AUX_DOC !=  "no"; then
+if  test $AUX_DOC !=  "no"; then
    AUX_DOC="yes"
    INSTALL_DOC="y"
 else
@@ -7064,11 +7088,14 @@ echo "
    Sysstat version:            $PACKAGE_VERSION
    Installation prefix:                $prefix
    rc directory:               ${RC_DIR}
-   Init directory:             ${INIT_DIR}
-   Systemd unit dir:           ${with_systemdsystemunitdir}
-   Configuration file:         ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
+   Init directory:             ${INIT_DIR}"
+if test $UCROND != "yes"; then
+   echo "   Systemd unit dir:          ${with_systemdsystemunitdir}"
+else
+   echo "   Use standard cron daemon"
+fi
+echo "   Configuration file:           ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
    Man pages directory:                $mandir
    Compiler:                   $CC
    Compiler flags:             $CFLAGS
 "
-
index 782f8038592dd4bba82f163198643d0e1a688897..13e31de75da8397af8f73d7c2a2356affbbe2357 100644 (file)
@@ -204,6 +204,7 @@ echo .
 #  --disable-pcp           do not link against PCP libraries even if available
 #  --disable-stripping     do not strip object files
 #  --enable-copy-only      only copy files when installing sysstat
+#  --enable-use-crond      use standard cron daemon
 #
 # Some influential environment variables:
 #  rcdir         directory where startup scripts are installed
@@ -551,6 +552,21 @@ if test $INSTALL_CRON = "y"; then
       REM_CHOWN=$CHOWN
    fi
 
+#  Check whether we should use the standard cron daemon
+   AC_MSG_CHECKING(whether we should use the standard cron daemon)
+   AC_ARG_ENABLE(use-crond,
+                AC_HELP_STRING([--enable-use-crond],
+                               [use standard cron daemon]),
+                               UCROND=$enableval,UCROND=no)
+   if test $UCROND != "yes"; then
+      USE_CROND=n
+      UCROND=no
+   else
+      USE_CROND=y
+   fi
+   AC_MSG_RESULT($UCROND)
+   AC_SUBST(USE_CROND)
+
 #  Crontab interval
    AC_MSG_CHECKING(crontab interval)
    AC_ARG_VAR([cron_interval],[crontab interval])
@@ -628,7 +644,7 @@ AC_ARG_ENABLE(documentation,
              AC_HELP_STRING([--disable-documentation],
                             [do not install documentation]),
                             AUX_DOC=$enableval,AUX_DOC=yes)
-if  test  $AUX_DOC !=  "no"; then
+if  test $AUX_DOC !=  "no"; then
    AUX_DOC="yes"
    INSTALL_DOC="y"
 else
@@ -701,11 +717,14 @@ echo "
    Sysstat version:            $PACKAGE_VERSION
    Installation prefix:                $prefix
    rc directory:               ${RC_DIR}
-   Init directory:             ${INIT_DIR}
-   Systemd unit dir:           ${with_systemdsystemunitdir}
-   Configuration file:         ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
+   Init directory:             ${INIT_DIR}"
+if test $UCROND != "yes"; then
+   echo "   Systemd unit dir:          ${with_systemdsystemunitdir}"
+else
+   echo "   Use standard cron daemon"
+fi
+echo "   Configuration file:           ${SYSCONFIG_DIR}/${SYSCONFIG_FILE}
    Man pages directory:                $mandir
    Compiler:                   $CC
    Compiler flags:             $CFLAGS
 "
-
diff --git a/iconfig b/iconfig
index fffea5fe00814dd75996cb4a9047231e5486e859..7fae24e3f799557a410304940c05ddcea9c63b2c 100755 (executable)
--- a/iconfig
+++ b/iconfig
@@ -1,6 +1,6 @@
 #!/bin/sh
 #@(#) Configuration script for sysstat
-# (C) 2000-2014 Sebastien GODARD (sysstat <at> orange.fr)
+# (C) 2000-2020 Sebastien GODARD (sysstat <at> orange.fr)
 
 ASK="sh build/Ask.sh"
 
@@ -126,6 +126,17 @@ then
        fi
 fi
 
+if [ "${CRON}" != "" ];
+then
+       USE_CROND=`${ASK} 'Use standard cron daemon? (y/n)' "--enable-use-crond" "use-crond"`
+       if [ "${USE_CROND}" = "y" ]; then
+               USE_CROND="--enable-use-crond "
+       else
+               USE_CROND=""
+               echo "Parameter --enable-use-crond is NOT set"
+       fi
+fi
+
 if [ "${CRON}" != "" ];
 then
        CRON_INTERVAL=`${ASK} 'Crontab sampling interval (in minutes):' "cron_interval" "cron_interval"`
@@ -211,7 +222,7 @@ fi
 
 echo
 echo -n "./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${SYSCONFIG_FILE} \
-${CLEAN_SA_DIR}${NLS}${HISTORY}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${RCDIR}"
+${CLEAN_SA_DIR}${NLS}${HISTORY}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${USE_CROND}${RCDIR}"
 if [ "${SADC_OPT}" != "" ];
 then
        echo -n "sadc_options=\"${SADC_OPT}\""
@@ -221,7 +232,6 @@ echo
 
 ./configure ${PREFIX}${SA_LIB_DIR}${SA_DIR}${SYSCONFIG_DIR}${SYSCONFIG_FILE} \
 ${CLEAN_SA_DIR}${NLS} \
-${HISTORY}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${RCDIR} \
+${HISTORY}${COMPRESSAFTER}${MAN}${IGNORE_FILE_ATTR}${CRON}${USE_CROND}${RCDIR} \
 sadc_options="${SADC_OPT}" ${COMPRESSMANPG}${INSTALL_DOC}${DEBUGINFO}${SENSORS} \
 ${PCP}${STRIP}${COPY_ONLY}
-