rpms/fcron/devel daemon_fcron_watch_config, 1.1, 1.2 fcron.spec, 1.16, 1.17 fcron_watch_config, 1.1, 1.2

Patrice Dumas pertusus at fedoraproject.org
Tue Dec 2 23:22:08 UTC 2008


Author: pertusus

Update of /cvs/extras/rpms/fcron/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv23366

Modified Files:
	daemon_fcron_watch_config fcron.spec fcron_watch_config 
Log Message:
* Sun Nov 30 2008 Patrice Dumas <pertusus[AT]free[DOT]fr> 3.0.4-3
  - fcron_watch_config really kill its children
  - remove crontabs requires, to be like cronie



Index: daemon_fcron_watch_config
===================================================================
RCS file: /cvs/extras/rpms/fcron/devel/daemon_fcron_watch_config,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- daemon_fcron_watch_config	30 Nov 2008 17:19:36 -0000	1.1
+++ daemon_fcron_watch_config	2 Dec 2008 23:21:34 -0000	1.2
@@ -1,8 +1,3 @@
 #! /bin/sh
 
-pid_file=$1
-[ "z$pid_file" = 'z' ] && pid_file=/var/run/fcron_watch_config.pid
-
-setsid fcron_watch_config > /dev/null 2>&1 &
-pid=$!
-ps --ppid $pid -o pid,cmd | grep inotifywait | awk '{print $1}' > $pid_file
+setsid fcron_watch_config "$@" > /dev/null 2>&1 &


Index: fcron.spec
===================================================================
RCS file: /cvs/extras/rpms/fcron/devel/fcron.spec,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- fcron.spec	30 Nov 2008 17:23:15 -0000	1.16
+++ fcron.spec	2 Dec 2008 23:21:35 -0000	1.17
@@ -1,6 +1,6 @@
 Name:		fcron
 Version:	3.0.4
-Release:	2%{?dist}
+Release:	3%{?dist}
 Summary:	A task scheduler
 Summary(fr):	Un ordonnanceur de tâches
 Summary(it):	Uno schedulatore di processi
@@ -80,7 +80,7 @@
 Summary:	Set up fcron to watch config files like Vixie cron does
 Group:		Applications/System
 Requires:       %{name} = %{version}-%{release}
-Requires:       inotify-tools, crontabs, /bin/ps, %{_bindir}/setsid
+Requires:       inotify-tools, %{_bindir}/setsid
 
 Requires(post):		chkconfig
 Requires(preun):	chkconfig, initscripts
@@ -258,6 +258,10 @@
 %{_sbindir}/daemon_fcron_watch_config
 
 %changelog
+* Sun Nov 30 2008 Patrice Dumas <pertusus[AT]free[DOT]fr> 3.0.4-3
+  - fcron_watch_config really kill its children
+  - remove crontabs requires, to be like cronie
+
 * Sun Nov 30 2008 Patrice Dumas <pertusus[AT]free[DOT]fr> 3.0.4-2
   - use newer post scripts
   - use .Package instead of .Dist


Index: fcron_watch_config
===================================================================
RCS file: /cvs/extras/rpms/fcron/devel/fcron_watch_config,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- fcron_watch_config	30 Nov 2008 17:19:36 -0000	1.1
+++ fcron_watch_config	2 Dec 2008 23:21:35 -0000	1.2
@@ -1,21 +1,58 @@
-#! /bin/sh
+#! /bin/bash
+
+pid_file=$1
+[ "z$pid_file" = 'z' ] && pid_file=/var/run/fcron_watch_config.pid
+
+echo $$ > $pid_file
+
+trap ':' TERM
 
 fcron_config_files="/etc/crontab /etc/fcrontab"
 fcron_present_files=
 
-res=
 while true; do
  fcron_present_files=
  for file in $fcron_config_files; do
   [ -f $file ] && fcron_present_files="$fcron_present_files $file"
  done
- inotifywait -q -q $fcron_present_files /etc/cron.d
- res=$?
- if [ z"$res" = 'z0' ]; then
-  check_system_crontabs
+ inotifywait -q $fcron_present_files /etc/cron.d &
+ inotifypid=$!
+ wait $inotifypid
+ inotifyres=$?
+
+ if [ z"$inotifyres" = 'z0' ]; then :
+  # some change on the file status, or file removal
+ elif [ z"$inotifyres" = 'z1' ]; then
+  # inotifywait exits with status 0 if a file was removed... So we should
+  # never go here (doc implies an exit status of 1 upon file removal?)
+  file_removed=no
+  for file in $fcron_present_files; do
+   if [ ! -f $file ]; then
+    file_removed=yes
+    break
+   fi
+  done
+  # some error happened
+  [ "$file_removed" = "no" ] && exit 1
  else
-  break
+  # a signal was received, kill inotifywait. Could verify that $inotifyres > 128.
+  kill -TERM $inotifypid
+  exit 0
+ fi
+
+ check_system_crontabs &
+ checkpid=$!
+ wait $checkpid
+ checkres=$?
+ # a signal was rececived. Kill the process without waiting for 30 sec.
+ # in fact the TERM is trap'ed, and during a sleep (in check_system_crontabs)
+ # it seems that the sleep isn't interrupted, but at least the main script
+ # is stopped and upon waking from the sleep check_system_crontabs should
+ # only do cleanup.
+ if [ $checkres -gt 128 ]; then
+  kill -TERM $checkpid
+  exit 0
  fi
 done
 
-# do something with res?
+# should never go here.




More information about the fedora-extras-commits mailing list