简体   繁体   中英

How to create crontab using shell_exec or exec?

Hello I am trying for the first time to use the crontab without using the terminal but only PHP file. I'm working locally with MAMP on mac. Am I doing something wrong?

<?php
$path= dirname(__FILE__);
shell_exec("crontab -e");
shell_exec("crontab */1 * * * * php ".$path."/run.php");

in run.php i would write a text file! Grazie ciao

看到这里: http : //www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/所以我想你可以把文件放到一个该文件夹的内容类似于“ * / 1 * * * * php”。$ path。“ / run.php”,仅此而已。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM