Setting Up A Cronjob In Windows Xampp

后端 未结 5 1148
终归单人心
终归单人心 2020-12-04 20:35

Help needed to set up this command in my Xampp windows server

0 * * * *     cd C:/xampp/htdocs/plugins/moviefeed/ && php cron.php

C

5条回答
  •  鱼传尺愫
    2020-12-04 21:04

    You can easily create a .bat file where you define your schedule task for windows. Regarding your needs..

    set doc=C:\xampp\htdocs\project
    cd "%doc%"
    copy /y nul "file.php"
    ECHO ^ >file.php
    schtasks /create /tn "Cron" /tr "C:\Program Files (x86)\Mozilla Firefox\firefox.exe http://play.local/fisierul.php" /st minute /mo 10
    

    What I did here is:

    • I changed the path to "project" directory from "htdocs"
    • I create a file "file.php" (if it doesn't exists)
    • I write a simple echo into the "file.php" file
    • And I create a new scheduler task (similar to cron jobs in Unix) wich will open my mozilla browser and access that url every 10 minutes.

    Note: to stop a scheduler task you must go in cmd and type

    schtasks /delete /tn "Cron"
    

    Good luck dude!

提交回复
热议问题