Crond doesn't in Rancher OS

Hello,

I’ve tried to setup some cron task on rancher OS with ubuntu console enabled.
Everything seems ok but the task is never executed, even with a * * * * * plannification (each minute).
I’ve tested with different installations of Rancher OS (0.4.2 & 0.4.3) with the same result…

Is it normal (I.E. have RancherOS a specificity that explain why crond doesn’t work properly) ?

2 Likes

Hello!
Same issue for me. My cron.d files and crontab are just ignored. Nothing in any logs. How can I run cron tasks?

Is a crond running…?
I think you have to build a crond (system-)container for that.

Did anyone end up figuring this out? Do I just need to spin up a crond system container to get this working?

I’d love to have a simple backup job run nightly on my Rancher Server.

Well, I ended up just setting things up so my Build Server running Ubuntu with a Jenkins Container just SSH’s into Rancher and runs the backup script as a part of the Build Server’s own backup cron job. Not a great work around, but it gets the job done.

Personally, I’ve no worry with crond on rancheros. I use it only for backup mysql db on my lab.

This is my cloud-config.yml

#cloud-config
hostname: rancher-server
write_files:
  - path: /var/spool/cron/crontabs/rancher
    permissions: "0600"
    owner: root
    group: rancher
    content: |
      * * * * * /bin/docker exec -t rancher-server1 mysqldump -A > /home/rancher/cattle.sql
  - path: /etc/rc.local
    permissions: "0755"
    owner: root
    content: |
      #!/bin/bash
      crond
rancher:
  services:
    rancher-server1:
      image: rancher/server
      restart: always
      ports:
        - 8080:8080
2 Likes

I’ve encountered the same problem.

I solved it using a bash script and supervisord

Thanks! That’s a good way to do it with RancherOS … having a crond running on reboot and a “persistent” crontab were just what I missed for running my docker routines that update images, remove exited docker processes and untagged images etc…