Hey folks, in one of my projects the user has to log data in their diary every day, I made a php script that scans the database and if no entry was found an email is sent reminding the user to log in the diary. Question is, how how can I make that automatic, never handled CRON jobs before so can anyone share a strategy on how to approach this?
Thank you
automatic daily server email
- D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Re: automatic daily server email
Hi Oliveira,
there are several possibilities.
a) you have access to a real cron on your system. You should be able to find some information about this on the web . Maybe https://crontab-generator.org or https://crontab.guru or https://foswiki.org/Support/CronWizard will do.
b) your webprovider might offer a cron job. I have seen this several times with a very easy to use web wizard.
c) create a cronjob using some service on the web https://www.easycron.com/ or https://www.cronjob.de
d) create your own script and run that every X minutes/seconds.
Whatever way you can use /decide to use, cron will do nothing but simply call the URL you supply.
This should make it obvious, that you might want to secure your script with some security check (like a password in the URL which is needed if the script is being run: https://example.com/automatic/mycron.php?pw=MySecret ).
Also you might want to have your script create some output, so that you can see that it has been run.
Enough information? If not, just ask again.
Olaf
there are several possibilities.
a) you have access to a real cron on your system. You should be able to find some information about this on the web . Maybe https://crontab-generator.org or https://crontab.guru or https://foswiki.org/Support/CronWizard will do.
b) your webprovider might offer a cron job. I have seen this several times with a very easy to use web wizard.
c) create a cronjob using some service on the web https://www.easycron.com/ or https://www.cronjob.de
d) create your own script and run that every X minutes/seconds.
Whatever way you can use /decide to use, cron will do nothing but simply call the URL you supply.
This should make it obvious, that you might want to secure your script with some security check (like a password in the URL which is needed if the script is being run: https://example.com/automatic/mycron.php?pw=MySecret ).
Also you might want to have your script create some output, so that you can see that it has been run.
Enough information? If not, just ask again.
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
- D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Re: automatic daily server email
Thank you for such a detailed explanation =) easycron.com was my choice, really simplified everything! Share your paypal email so I can show you some modest appreciation, I contacted appgini support and asked them to enable a section for paid services or donations and they said they might work on it so thats good news for the community, once again, thanks a lot.
Cheers
Cheers
Re: automatic daily server email
Hi Oliveira,
glad, that it helped you.
All good.
Take care
Olaf
glad, that it helped you.
All good.
Take care
Olaf
Some postings I was involved, you might find useful:
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
SingleEdit - Prevent concurrent edits on records; Field Permissions; Column-Value-Based-Permissions; Custom (error) message; Audit Log; Backup your database; Two Factor Authentication; Block brute force (failed) logins; Add 2nd SAVE CHANGES button; Place a search on details view
Re: automatic daily server email
Hi,
I personnally used Apps Script from Google https://script.google.com/, where you can create a short script calling the URL you want.
You can then set Triggers so it is executed when you want (daily, weekly, monthly, etc).
In each App Script file you can create as many functions as you want, and then set triggers for each function following different scenarios for each. For example you could want to execute a job everyday, but maybe once a week you need other information or calling other php script.... So you will have to create two functions in the same AppsScript file and set a trigger for each function. It's all in Javascript.
As stated by Olaf it is recommended to add some kind of security like a token in the URL that you will have to check before executing your php script.
I personnally used Apps Script from Google https://script.google.com/, where you can create a short script calling the URL you want.
You can then set Triggers so it is executed when you want (daily, weekly, monthly, etc).
Code: Select all
function executeDailyEmailAlerts_inExternalApp() {
var response = UrlFetchApp.fetch('https://yourAppUrl/yourscript.php');
return "ok";
};
As stated by Olaf it is recommended to add some kind of security like a token in the URL that you will have to check before executing your php script.
- D Oliveira
- AppGini Super Hero
- Posts: 347
- Joined: 2018-03-04 09:30
- Location: David
Re: automatic daily server email
thank you for taking the time, thats is also a clever way to approach this, already paid for the easycron subscription lol but will definitely give it a shot on my upcoming projects, thanks again mate.
Cheers
Cheers
Re: automatic daily server email
Hello!
Can you help me with the script that scans the database and if no entry was found email is sent?
It is useful for me also.
Thank you
Can you help me with the script that scans the database and if no entry was found email is sent?
It is useful for me also.
Thank you