|
Posted by nico on 10/23/21 11:38
> Since you're going to do something with your mysql db, use it for logging
> too. Create a table where you will store timestamps of your script's runs.
> Then check for the latest time the script ran and do the job if enough
> amount of time elapsed since.
I appreciate your suggestion, but that means that my script has to
'open' a connection to the database in the first place (this is the
overhead I'm trying to avoid). That's why I'm thinking of a log file
for this.
So, if I log it in the db I have to: 1) Connect 2) Check timestamp 3)If
timestamp says it was run today...Close connection and do nothing, or,
If Timestamp says it wasn't ran, do the check on which users need to be
notified. Whereas, if I do the log file, I 1) Open file and parse
checking for timestamp 2) Then only if I haven't done the notification
check today, THEN connect to db...so if I've already done the work, I
don't have to open up a connection. LMK if I'm missing something ;)
> PS: That script can be called not only from your home pc. It also can be
> called from your index page that in its turn is called a number of times a
> day. With the timestamp checking logic it won't take too much resources.
I thought about that, but initially I might not get a hit every day
(haven't put up the site yet), if this happens, I could have a
notification due the day my index ISN'T hit, and not notify the user.
[Back to original message]
|