I have a php file in my server which used to send a mail. I want to trigger that file at particular time in day to send a mail. So i have planned to create a window service to trigger.But i don't know how to do it and how to mentioned the URL in a window service. So if you share any links or ideas it's more helpful to me.
Asked
Active
Viewed 71 times
0
-
use cron jobs. http://stackoverflow.com/questions/22358382/execute-php-script-in-cron-job – mega6382 Nov 24 '15 at 10:11
-
Is there is any possibility to trigger by window service. – Karthik Nov 24 '15 at 10:18
-
1What window's service do you want to use? – mega6382 Nov 24 '15 at 10:24
-
I have tried to call the URL(php file location in server) through my C# window service. – Karthik Nov 24 '15 at 10:34
2 Answers
0
Create/Run cron jobs using ssh:
login in to server using ssh ..
type crontab -e
*/1 * * * * php SCRIPT_NAME --> this will run every minute
00 00 * * * php SCRIPT_NAME --> this will run at 12 AM every day
*/5 * * * * php SCRIPT_NAME -> every 5 minutes
if its giving you an option to select editor after crontab -e command, then select vim or vim basic
(To run python scripts replace php with python e.g. */1 * * * * python SCRIPT_NAME --> this will run every minute)
7,22,37,52 * * * * /usr/local/cpanel/whostmgr/bin/dnsqueue > /dev/null 2>&1 ---> cron will run on 7th, 22nd, 37th and 52nd min of every hour

Waqas Shahid
- 1,051
- 1
- 7
- 22
0
If you want to call a website from C# all you should need is
WebRequest webRequest = WebRequest.Create("URL_HERE");
WebResponse webResp = webRequest.GetResponse();
replace the URL_HERE
in above example with your URL.

mega6382
- 9,211
- 17
- 48
- 69