Cron inside any containers

I hope I am not destroying an opened port but with the migration of my server I found a funny way to make acron inside a container. Initially it was with webserver to make a rsync of remote mirrors……smserver.de-labrusse.fr and nethserver.de-labrusse.fr

I do not know why but what we documented was not workable but anyway it seems more a hack or something that we expect to work and sometimes the cron is simply not implemented in a container…..but we need it

in fact for each rootfull or rootless container we can implement a cron

runagent -m webserver1
crontab -e
15 /3 * * * podman exec -ti sftpgo rsync --progress -aHS --partial --delete --exclude='.iso’ rsync://mirror.nethserver.org/nethserver /srv/sftpgo/data/xxxx/
45 /3 * * * podman exec -ti sftpgo rsync --progress -aHS --partial --delete distro.ibiblio.org::smeserver --exclude=obsolete/ --exclude=contribs/ --exclude='.iso’ /srv/sftpgo/data/xxxx/

Obviously you need to get rsync workable in the container but it is what the sftgo container does

or with root user

[root@ns8 ~]# crontab -e
45 /3 * * */usr/local/bin/runagent -m webserver1 podman exec -ti sftpgo rsync --progress -aHS --partial --delete --exclude=‘*.iso’ rsync://mirror.nethserver.org/nethserver /srv/sftpgo/data/xxxx/

2 Likes

Ahhhh your contrib reborn?

how can you read in my mind :smiley:

1 Like

i wanted to ask why rsync, then i saw this.. Nice one.

We have been battling with cron management recently

Please note that this contrib is for NS6 and NS7, there is no app for NS8 yet…