a100806
July 25th, 2007, 05:07 AM
At every run zrm-pre-scheduler rewrites the crontab. In our installation this used to lead to heaps of comments on top of the crontab like
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/zrm-prescheduler40ec7 installed on Wed Jul 25 02:00:03 2007)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
# (/tmp/zrm-preschedulerdsI0f installed on Wed Jul 25 02:00:03 2007)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
# (/tmp/zrm-prescheduler1ajeK installed on Wed Jul 25 02:00:03 2007)
...
After updating to Version 1.2 of mysql-zrm only half of the bogus lines remain:
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/zrm-preschedulerUHxKM installed on Wed Jul 25 13:30:02 2007)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
# (/tmp/zrm-preschedulerdsI0f installed on Wed Jul 25 02:00:03 2007)
# (/tmp/zrm-prescheduler1ajeK installed on Wed Jul 25 02:00:03 2007)
# (/tmp/zrm-preschedulerpUGjJ installed on Wed Jul 25 02:00:03 2007)
...
I found that in /usr/bin/zrm-pre-scheduler there is code that tries to filter these lines from the temporary file that will serve as input for the crontab command. We have in line 136
/^# DO NOT EDIT.*/ || /^# \(\/tmp\/crontab.*/ || /^# \(Cron version --.*/
and 176:
/^# DO NOT EDIT.*/ || /^# \(\/tmp\/.*crontab.*/ || /^# \(Cron version .*/
(I wonder why they are different ... )
The filter for Cron version in line 176 works now, that's why only half of the lines remain.
Unfortunately, the filter for /tmp/.*crontab or /tmp/crontab cannot match, because zrm-pre-scheduler installs its crontabs from /tmp/zrm-prescheduler*, not from a file or directory beginning with or containing the string crontab.
Can't we change either the temp file pattern of zrm-pre-scheduler to contain something like crontab or the regex to match the entries as they are, so that these comments aren't infinitely copied?
Kind regards, Holger
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/zrm-prescheduler40ec7 installed on Wed Jul 25 02:00:03 2007)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
# (/tmp/zrm-preschedulerdsI0f installed on Wed Jul 25 02:00:03 2007)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
# (/tmp/zrm-prescheduler1ajeK installed on Wed Jul 25 02:00:03 2007)
...
After updating to Version 1.2 of mysql-zrm only half of the bogus lines remain:
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/zrm-preschedulerUHxKM installed on Wed Jul 25 13:30:02 2007)
# (Cron version V5.0 -- $Id: crontab.c,v 1.12 2004/01/23 18:56:42 vixie Exp $)
# (/tmp/zrm-preschedulerdsI0f installed on Wed Jul 25 02:00:03 2007)
# (/tmp/zrm-prescheduler1ajeK installed on Wed Jul 25 02:00:03 2007)
# (/tmp/zrm-preschedulerpUGjJ installed on Wed Jul 25 02:00:03 2007)
...
I found that in /usr/bin/zrm-pre-scheduler there is code that tries to filter these lines from the temporary file that will serve as input for the crontab command. We have in line 136
/^# DO NOT EDIT.*/ || /^# \(\/tmp\/crontab.*/ || /^# \(Cron version --.*/
and 176:
/^# DO NOT EDIT.*/ || /^# \(\/tmp\/.*crontab.*/ || /^# \(Cron version .*/
(I wonder why they are different ... )
The filter for Cron version in line 176 works now, that's why only half of the lines remain.
Unfortunately, the filter for /tmp/.*crontab or /tmp/crontab cannot match, because zrm-pre-scheduler installs its crontabs from /tmp/zrm-prescheduler*, not from a file or directory beginning with or containing the string crontab.
Can't we change either the temp file pattern of zrm-pre-scheduler to contain something like crontab or the regex to match the entries as they are, so that these comments aren't infinitely copied?
Kind regards, Holger