Project

General

Profile

Actions

Bug #8825

closed

crontab frequency does not support reserved string @reboot

Bug #8825: crontab frequency does not support reserved string @reboot

Added by Jérémy HOCDÉ over 9 years ago. Updated about 9 years ago.

Status:
Released
Priority:
N/A
Assignee:
Jonathan CLARKE
Category:
Techniques
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
Name check:
Fix check:
Regression:

Description

Hello,

I have a crontab like this :

@reboot root /directories/script.sh &> /dev/null

But I can't use @reboot at the line frequency, I have this message when I save:

The form contains some errors, please correct them.
Please modify Manually defined frequency to match the requested format : Please enter a valid cron interval

@reboot is a reserved words for crons
Could you help me to solve this problem ?

Thks a lot

tested with rudder-server 3.2.4 on ubuntu 14.04


Files

cronManagement-technique.diff (530 Bytes) cronManagement-technique.diff Jérémy HOCDÉ, 2016-08-09 11:55
3.1.tar.gz (2.75 KB) 3.1.tar.gz techniques/systemSettings/systemManagement/cronManagement 3.1 Jérémy HOCDÉ, 2016-08-09 12:13
3.1.tar.gz (2.76 KB) 3.1.tar.gz coquille Jérémy HOCDÉ, 2016-08-09 12:42

Updated by Janos Matya over 9 years ago Actions #1

It might be worth mentioning, that there are also other special prefixes as of man 5 crontab:

@reboot    :    Run once, at startup.
@yearly    :    Run once a year, ie.  "0 0 1 1 *".
@annually  :    Run once a year, ie.  "0 0 1 1 *".
@monthly   :    Run once a month, ie. "0 0 1 * *".
@weekly    :    Run once a week, ie.  "0 0 * * 0".
@daily     :    Run once a day, ie.   "0 0 * * *".
@hourly    :    Run once an hour, ie. "0 * * * *".

Updated by Jérémy HOCDÉ over 9 years ago Actions #2

Hello

is it possible to add manually special prefixes into technique (file) "Cron daemon configuration version 3.0" ?

Updated by Jonathan CLARKE over 9 years ago Actions #3

  • Target version changed from 3.2.6 to 2.11.24

Thanks for the report Jérémy.

The allowed strings are defined by a (rather long) regex in https://github.com/Normation/rudder-techniques/blob/master/techniques/systemSettings/systemManagement/cronManagement/3.0/metadata.xml#L95. That same file is on Rudder servers under /var/rudder/configuration-repository/techniques/...

If you can patch the regex to accept those strings, you have a workaround. If you can a patch submitted via GitHub pull request would be most welcome!

Updated by Jérémy HOCDÉ over 9 years ago Actions #4

Jérémy HOCDÉ wrote:

Hello

is it possible to add manually special prefixes into technique (file) "Cron daemon configuration version 3.0" ?

I tried to
edit /opt/rudder/share/techniques/systemSettings/systemManagement/cronManagement/3.0/metadata.xml
restart server services
create new directive

and I don't see my modifications

is it somewhere else ?

Updated by Jonathan CLARKE over 9 years ago Actions #5

No, that's the correct location, but this is a git repository. After making changes you need to git add <file> && git commit -m "Useful message here". Then run "rudder server reload-techniques" (or click on "Reload techniques" in the web interface under Settings)

Updated by Jonathan CLARKE over 9 years ago Actions #6

Oh, sorry, wait. No, that is not the right location. That is the distribution standard copy of Techniques. Please don't ever edit them.

The correction location is the one I gave above, under /var/rudder/configuration-repository/techniques/...

Updated by Jérémy HOCDÉ over 9 years ago Actions #7

Jonathan CLARKE wrote:

Thanks for the report Jérémy.

The allowed strings are defined by a (rather long) regex in https://github.com/Normation/rudder-techniques/blob/master/techniques/systemSettings/systemManagement/cronManagement/3.0/metadata.xml#L95. That same file is on Rudder servers under /var/rudder/configuration-repository/techniques/...

If you can patch the regex to accept those strings, you have a workaround. If you can a patch submitted via GitHub pull request would be most welcome!

Tanks Jonathan,

I edited metadata.xml into /var/rudder/configuration-repository/techniques/systemSettings/systemManagement/cronManagement/3.0 to add a new item (into diff file)
I presume just add a item can make me use predefined value for special prefixes
but i was mistaken

I can modify regex but this is not really what i want to do, I think add item may be a more efficient solution (and '''chronophage-less''' frenglish inside :þ)

Updated by Jérémy HOCDÉ over 9 years ago Actions #8

Jonathan CLARKE wrote:

Oh, sorry, wait. No, that is not the right location. That is the distribution standard copy of Techniques. Please don't ever edit them.

The correction location is the one I gave above, under /var/rudder/configuration-repository/techniques/...

noted ! I will not :)

Jonathan CLARKE wrote:

No, that's the correct location, but this is a git repository. After making changes you need to git add <file> && git commit -m "Useful message here". Then run "rudder server reload-techniques" (or click on "Reload techniques" in the web interface under Settings)

It works perfectly
I created a new technique 3.1 with .diff file

user@machine:/var/rudder/configuration-repository/techniques/systemSettings/systemManagement/cronManagement# git add 3.1/
user@machine:/var/rudder/configuration-repository/techniques/systemSettings/systemManagement/cronManagement# git commit -a -m "Add reboot into cronManagement technique (3.1)"
[master 6732a6d] Add reboot into cronManagement technique (3.1)
3 files changed, 247 insertions(+)
create mode 100644 techniques/systemSettings/systemManagement/cronManagement/3.1/changelog
create mode 100644 techniques/systemSettings/systemManagement/cronManagement/3.1/cronConfiguration.st
create mode 100644 techniques/systemSettings/systemManagement/cronManagement/3.1/metadata.xml

Updated by Jérémy HOCDÉ over 9 years ago Actions #9

petite coquille dans le changelog
le ticket peut etre clos

merci encore

Updated by Vincent MEMBRÉ over 9 years ago Actions #10

  • Target version changed from 2.11.24 to 308

Updated by Alexis Mousset over 9 years ago Actions #11

  • Target version changed from 308 to 3.1.14

Updated by Alexis Mousset over 9 years ago Actions #12

  • Status changed from New to In progress
  • Assignee set to Alexis Mousset

Updated by Alexis Mousset over 9 years ago Actions #13

  • Status changed from In progress to Pending technical review
  • Assignee changed from Alexis Mousset to Jonathan CLARKE
  • Pull Request set to https://github.com/Normation/rudder-techniques/pull/1015

Updated by Alexis Mousset over 9 years ago Actions #14

  • Status changed from Pending technical review to Pending release
  • % Done changed from 0 to 100

Updated by Vincent MEMBRÉ about 9 years ago Actions #15

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 3.1.15/14 and 3.2.8/7 which were released today.

Actions

Also available in: PDF Atom