Loading... # 编写脚本 crontab定时任务只能执行脚本,所以,我们必须写先一个脚本 我这里路径是`/root` ```shell vim vim nextcloud-crontab.sh ``` 脚本内容 ```shell #!/bin/bash docker exec nextcloud /bin/bash -c "su www-data -s /bin/bash -c 'php cron.php'" ``` 设置可执行权限 ```shell chmod 777 nextcloud-crontab.sh ``` # 设置定时任务 ```shell crontab -e ``` 第一次打开`crontab -e`会提示你选一个编辑器,我这里是nano ``` */5 * * * * /bin/sh /root/nextcloud-crontab.sh ```  按CTRL +X推出然后按Y确定 回车 最后修改:2022 年 04 月 18 日 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 0 如果觉得我的文章对你有用,请随意赞赏