I have a Linux server at home and need to locate its IP address through the peanut Shell's DDNS. So create a script as follows to solve the problem of the recently appearing routing embedded device cannot DNS resolution, if you have the same needs as I do, welcome to this tutorial:
1, the installation of Yum package
Yum-y Install Curl
2. Create a folder to store scripts
mkdir ~/script
3. Create a domain name resolution script
Vim Editor ~/script/pusoray.sh
Add the following content:
#!/bin/bash
domain="example.oicp.net"
user="example"
pwd="pwd1"
/usr/bin/curl "http://$user:[email protected]/ph/update?hostname=$domain"
Note the parameters that need to be changed:
1) domain-name of your application for peanut shell
2) User-Login Peanut Shell account
3) PWD-Login peanut Shell password
4. Add a Scheduled task
Crontab-e
Add the following (performed every 5 minutes):
*/5 * * * * SH ~/script/pusoray.sh
Check:
Crontab-l
Reference documents:
Http://open.oray.com/wiki/doku.php?id=%E6%96%87%E6%A1%A3:%E8%8A%B1%E7%94%9F%E5%A3%B3:http%E5%8D%8F%E8%AE%AE%E8 %af%b4%e6%98%8e
This article is from the "Old Tan Linux Blog" blog, please be sure to keep this source http://cmdschool.blog.51cto.com/2420395/1703233
Peanut shell Dynamic Domain name resolution through the Linux shell (DDNS)