How to automatically delete pages

Hello, I finished my Kirby site. Now I want to automatically delete pages (in this case past dates of events) if the date is yesterday. I figured out I need a cronjob to do that. But I’ve never done that before. Could someone please check whether my code is ok?


everyday at 01:00 am


folder with date of day before (eg. 20210619_nameOfEvent)


1 * * * rm /XXXXX_XXXX/webseite/name/content/4_termine/date -d „yesterday“ +’\%Y-\%m-\%d_*'

I host my site at, if someone has tipps how to setup a cron job there I am all ears (:

Thank you for your time in advance!

All the best


You will find all information regarding cronjobs in the FAQ of What you can do with cronjobs depends on your package there.

Basically, do not try to execute your delete command there. Start a shell script which does the job, i.e. in cron:

0 1 * * * test -x /your/ && /your/

And in /your/


Everything you need to do...

exit 0

With the test -x ... && ... construct your script will only executed if it is executable. That way, you can pause your job if you like just by make it not executable and not manipulating the crontab again.

Thank you!

Do you know where I should put the following line?
0 1 * * * test -x /your/ && /your/

I added a cronjob via the customer menu, but I don’t understand where to put that line.

My shell script now looks like this:


rm /kunden/kundennummer/webseiten/kundenname/content/4_termine/`date -d 'yesterday' '+%Y%m%d_*'`

exit 0

Do I need a chmod -x to make the script executable? And where should I put it?

Thanks in advance!

Your questions are specific to DomainFactory’s implementation of cronjobs and since I do not have an account there, I just can’t tell.

Usually yes, but again, I do not know how DF is implementing cronjobs for customers, it is just visible from outside, that they provide cronjobs.

As a side note, you should think twice about your approach of just deleting something from the filesystem. Maybe it would be better to make use of Kirby’s API to delete the page(s) or instead of that, set the status of these pages to draft in order to just remove them from the visibility at the front end but not from the panel. Just ideas coming into my mind without knowing your business case here.