Project

General

Profile

Bug #8825

crontab frequency does not support reserved string @reboot

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

Status:
Released
Priority:
N/A
Category:
Techniques
Target version:
Severity:
User visibility:
Effort required:
Priority:

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
#1

Updated by Janos Matya over 4 years ago

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 * * * *".
#2

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

Hello

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

#3

Updated by Jonathan CLARKE over 4 years ago

  • 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!

#4

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

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 ?

#5

Updated by Jonathan CLARKE over 4 years ago

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)

#6

Updated by Jonathan CLARKE over 4 years ago

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/...

#7

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

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 :þ)

#8

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

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

#9

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

petite coquille dans le changelog
le ticket peut etre clos

merci encore

#10

Updated by Vincent MEMBRÉ over 4 years ago

  • Target version changed from 2.11.24 to 308
#11

Updated by Alexis MOUSSET over 4 years ago

  • Target version changed from 308 to 3.1.14
#12

Updated by Alexis MOUSSET over 4 years ago

  • Status changed from New to In progress
  • Assignee set to Alexis MOUSSET
#13

Updated by Alexis MOUSSET over 4 years ago

  • 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
#14

Updated by Alexis MOUSSET over 4 years ago

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

Updated by Vincent MEMBRÉ over 4 years ago

  • 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.

Also available in: Atom PDF