Change time when hourly, daily, weekly... cron jobs run

    • OMV 2.x
    • Change time when hourly, daily, weekly... cron jobs run

      Hey,
      Maybe I'm really annoying these days because I'm reconfiguring my box and I'm trying to make my box as personal as I can but I'm a newbie (aka n00b) in Linux stuff, se here I go:

      I browsed through Ubuntu, Debian and general Linux forums looking for clues on how to change the time when the "hourly", "daily", "weekly" and "monthly" cron jobs run. I found that it is configured in /etc/crontab. I modified it at my needs and now it looks like this:
      Display Spoiler
      # /etc/crontab: system-wide crontab
      # Unlike any other crontab you don't have to run the `crontab'
      # command to install the new version when you edit this file
      # and files in /etc/cron.d. These files also have username fields,
      # that none of the other crontabs do.

      SHELL=/bin/sh
      PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

      # m h dom mon dow user command
      20 * * * * root cd / && run-parts --report /etc/cron.hourly
      0 10 * * * root test -x /usr/sbin/anacron | | ( cd / && run-parts --report /etc/cron.daily )
      0 16 * * 7 root test -x /usr/sbin/anacron | | ( cd / && run-parts --report /etc/cron.weekly )
      0 13 1 * * root test -x /usr/sbin/anacron | | ( cd / && run-parts --report /etc/cron.monthly )
      #


      I have only modified the times as in some forums said. Then, I created a scheduled job (MySQL backup) set to run "hourly". Regarding the 'custom' crontab file, it should have run 20 minutes past every hour, but the backup was executed at an hour o'clock. Is that because OpenMediaVault uses another configuration file for the cronjobs?

      PS: I rebooted my machine after editing my crontab file so the cron daemon would be reloaded just in case...


      Thanks in advance and sorry for the annoyance! I'm trying to learn so later I can help some people out there also...


      Guillem.
      DISCLAIMER: :!: I'm not a native English speaker, I'm sorry if I don't explain as good as you would want. :!:

      My NAS:
      Always the latest OMV Erasmus running on an AMD Sempron 3850 @1.3GHz with 4.9.0 Backports Kernel
      with 120GB Samsung SSD 850 EVO for OpenMediaVault & 2x500GB Primary Data HDD + 1TB Secondary HDD for Backup & 2TB USB 3.0 External HDD for offline backup

      Plugin list:
      Flash Memory, Locate, OMV-Extras.org, RSnapshot, Sensors, Syncthing, SMB/CIFS, SSH, USB Backup
      _____________________________________________________________________________________________________________________________

      The Schrödinger's code is that one which is going to work and it's full of bugs at the same time; until you test it, you won't be able to determine it.
    • Thanks for the quick reply Sub!
      I use them, but I have to choose always 'certain date' and put it in manually and the hourly, daily, weekly options are useless because I don't know at what time will they be executed.
      DISCLAIMER: :!: I'm not a native English speaker, I'm sorry if I don't explain as good as you would want. :!:

      My NAS:
      Always the latest OMV Erasmus running on an AMD Sempron 3850 @1.3GHz with 4.9.0 Backports Kernel
      with 120GB Samsung SSD 850 EVO for OpenMediaVault & 2x500GB Primary Data HDD + 1TB Secondary HDD for Backup & 2TB USB 3.0 External HDD for offline backup

      Plugin list:
      Flash Memory, Locate, OMV-Extras.org, RSnapshot, Sensors, Syncthing, SMB/CIFS, SSH, USB Backup
      _____________________________________________________________________________________________________________________________

      The Schrödinger's code is that one which is going to work and it's full of bugs at the same time; until you test it, you won't be able to determine it.
    • Yes, I know how cron job schedule work from the webGUI.
      What I'm trying to achieve is go further and be able to select "hourly" instead of "certain time" and also be able to choose when the hourly cron jobs will run.
      Maybe I'm complicating myself with unnecessary configurations but, I would like to see if there is any option to change this config.

      It is just [SPANISH] para rizar el rizo, o dar una vuelta de tuerca más [/SPANISH] Hope you understand it ;)
      DISCLAIMER: :!: I'm not a native English speaker, I'm sorry if I don't explain as good as you would want. :!:

      My NAS:
      Always the latest OMV Erasmus running on an AMD Sempron 3850 @1.3GHz with 4.9.0 Backports Kernel
      with 120GB Samsung SSD 850 EVO for OpenMediaVault & 2x500GB Primary Data HDD + 1TB Secondary HDD for Backup & 2TB USB 3.0 External HDD for offline backup

      Plugin list:
      Flash Memory, Locate, OMV-Extras.org, RSnapshot, Sensors, Syncthing, SMB/CIFS, SSH, USB Backup
      _____________________________________________________________________________________________________________________________

      The Schrödinger's code is that one which is going to work and it's full of bugs at the same time; until you test it, you won't be able to determine it.
    • your complicating yourself more. Daily, hourly weekly flags are based on anacron, they will run whenever they can once the interval is achieved.

      If you want hourly at specific minute just deselect the hourly to number and put * asterisk. Because is confusing if you want a task hourly and then you say you want it at specific time , i assume you want every hour at specific minute let's say 34?
      New wiki
      chat support at #openmediavault@freenode IRC | Spanish & English | GMT+10
      telegram.me/openmediavault broadcast channel
      openmediavault discord server
    • Exact. I would like to change the hourly, daily... whatever at a time that fits my needs. For example, as you said (and as I tried to configure in the /etc/crontab file above), run the hourly commands at 20 minutes past every hour, the daily jobs to run everyday at 10AM...
      DISCLAIMER: :!: I'm not a native English speaker, I'm sorry if I don't explain as good as you would want. :!:

      My NAS:
      Always the latest OMV Erasmus running on an AMD Sempron 3850 @1.3GHz with 4.9.0 Backports Kernel
      with 120GB Samsung SSD 850 EVO for OpenMediaVault & 2x500GB Primary Data HDD + 1TB Secondary HDD for Backup & 2TB USB 3.0 External HDD for offline backup

      Plugin list:
      Flash Memory, Locate, OMV-Extras.org, RSnapshot, Sensors, Syncthing, SMB/CIFS, SSH, USB Backup
      _____________________________________________________________________________________________________________________________

      The Schrödinger's code is that one which is going to work and it's full of bugs at the same time; until you test it, you won't be able to determine it.