Raspberry Pi Combat 4: Configure one hour to send a message

Source: Internet
Author: User

Pick up


Configure Crontab, which is the timing task that Linux comes with.


CRONTAB-E Start Configuration

When you open it you'll see a lot #

On the last line


*/60 * * * * sh/home/pi/desktop/check.sh

Save, exit, installing new crontab appears

/60 means the interval is 60 minutes, or 1, is the interval 1 minutes

Write in the check.sh.

echo "Current time: ' Date ' +%f%T '." >> Ip.log

echo "This is my internal IP address." >>ip.log
Ifconfig | grep ' Bcast ' | cut-d b-f 1 >> ip.log
Python mail.py
echo "Master,i has sent you an email.please check!" >>ip.log

Save, exit

Wait 60 minutes after the discovery and did not receive the message.

I crontab instructions in various attempts, check.sh various changes, view crontab log, all kinds of Google found: must be the right!

chmod 777 check.sh

sudo reboot

After waiting 60 Minutes again, you should be able to receive hard-won emails.

If the test encountered a bug, how also can not solve, you may first change to/1, write the file log, view crontab execution log to solve.

Congratulations, you can now use the Raspberry Pi to make your own IP address automatically sent to your own mailbox by email every hour.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Raspberry Pi Combat 4: Configure one hour to send a message

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.