简体   繁体   中英

Scheduled Task, Open URL/PHP file every n minutes based on value in MySQL DB in Raspberry Pi

I'm hoping someone can help me find the best/easiest solution for a problem I'm having. I have a Raspberry Pi (Raspbian) that is operating a LAMP server. I am looking for a simple way to call one of the local PHP files every n minutes based on a record stored on the local MySQL database. The file is available at a local and remote URL so both of those are options as well.

I considered using a cron job but I don't know of any way to use a variable amount of time for this task.

I'm using this PHP file to execute some basic tasks and post data to a Spark Core so until I get this figured out, I'm stuck manually calling the URL.

  1. set up a google script with the code to call your sparkcore

    (see code)

  2. call your google script with a trigger

example showing a google script: How to post to Google Docs Form directly

// google script code example to access spark core
function getDevices(accessToken) {
  var url = "https://api.spark.io/v1/devices?access_token="+accessToken;
  var response = UrlFetchApp.fetch(url);
  return response;
}

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