Are There Any Cron Jobs Alternative?

前端 未结 8 2074
礼貌的吻别
礼貌的吻别 2020-12-09 19:43

Cron Jobs are closed on my server and server admin doesn\'t accept open it. Because , cron jobs slowing server etc. So, i need an alternative.

I have to run a php fi

8条回答
  •  清歌不尽
    2020-12-09 20:06

    Just an addition to the Answers. Rare case scenario.

    If your application is having frequent amount of database operations then you can maintain a separate table where the the one column will work as a measure when to run the script. Example as below

    Table CRON_RUN

    last_run
    ----------
    12-09-2018 11:55:12 (dd-mm-yyyy H:M:S)
    

    Now in your application a check can be performed every time when those frequent db operations occurs and check if the last_run date and the current date is having x difference . X is difference in time you want to run the script. 2 minutes in your case. Also if the difference is more then or equal to 2 minutes then the update statement will run to update the last_run column with the current date time and the next statement will be you cron.php script .

提交回复
热议问题