# Cron don't work

**URL:** <https://help.nextcloud.com/t/cron-dont-work/170074>\
**Category:** 📦 Appliances (Docker, Snappy, VM, NCP, AIO)\
**Tags:** docker, ubuntu, cron\
**Created:** [September 13, 2023, 2:28pm UTC](https://help.nextcloud.com/t/cron-dont-work/170074 "2023-09-13T14:28:04Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![steini86](https://help.nextcloud.com/user_avatar/help.nextcloud.com/steini86/32/54481_2.png) [@steini86](https://help.nextcloud.com/u/steini86)\
**Post date:** [September 13, 2023, 5:12pm UTC](https://help.nextcloud.com/t/cron-dont-work/170074/2 "2023-09-13T17:12:08Z")

</div>

Your cron entry is wrong. First try on the command line if it works, then put it in cron.  
I never used sudo in cron commands, but depending on your configuration that might not work. If you need root rights, then put it in the root crontab.  
Your command executes it in container “nextcloud”. If you have a second container, it will have a different name which you should use.

See also: [Nextcloud Docker Container - best way to run cron job - #4 by sanctimon](https://help.nextcloud.com/t/nextcloud-docker-container-best-way-to-run-cron-job/157734/4)

`docker exec -it CONTAINERNAME crontab -e -u www-data` should open your crontab, then put there `*/5 * * * * php -f /var/www/html/cron.php`  
Or do it like here: [Docker setup & cron - #7 by lazmol](https://help.nextcloud.com/t/docker-setup-cron/78547/7)

---

_[View the full topic](https://help.nextcloud.com/t/cron-dont-work/170074)._
