문제 설명
창 서비스를 사용하여 PHP 파일 트리거 (Trigger a php file using window service)
메일을 보내는 데 사용했던 php 파일이 서버에 있습니다. 하루 중 특정 시간에 해당 파일을 실행하여 메일을 보내도록 하고 싶습니다. 그래서 나는 트리거할 윈도우 서비스를 만들 계획을 세웠습니다. 하지만 그것을 하는 방법과 윈도우 서비스에서 URL을 언급하는 방법을 모릅니다. 따라서 링크나 아이디어를 공유하면 저에게 더 도움이 됩니다.
참조 솔루션
방법 1:
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
방법 2:
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.
(by Karthik、Waqas Shahid、mega6382)