开发者

Setting up a cron Job

Please I am new to cron jobs and only heard of it recently.

The thing is I am trying to send a message to myself via a phpscript.

I need the cron job to read the php cript and send the appropriate message.

here is the php self mailer I have in place.

<?php
    $recipient = "*******@gmail.com";
    $subject = "Flight Status";
    $body = "Flight has just landed.";
    if(mail($recipient, $subject, $body))
    {
        echo("<p>Message successfully sent</p>");
开发者_开发百科    }
    else
    {
        echo("<p>Message Delivery failed </p>");
    }
?>


you can read the manual for cron with man 5 crontab. It contain example as well. for example,

# run at 2:15pm on the first of every month -- output mailed to paul

15 14 1 * * $HOME/bin/flight.php


Sending email through phone is complicated, as you need a smtp server set up. A better solution would be to send yourself a message via a chat application.

I personally use nimrod for this : https://www.nimrod-messenger.io It's messenger only but other chat systems are planned.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜