ラズベリーパイの筆記(四)はネットの住所を取得します。

2370 ワード

CCTVに感謝します。MTVに感謝します。高主任が書いてくれた台本に感謝します。
原文は高主任cuフォーラムに掲載されています。http://blog.chinaunix.net/uid-25256412-id-4228235.html
 
1>: 配置postfixのインストール
# apt-get install postfix   (  postfix)
 :
# aptitude install postfix
# echo 'www.yes4ko.com' >/etc/hostname   (     )
# echo 'X.X.X.X www.yes4ko.com www' >> /etc/hosts
# echo 'X.X.X.X ftp.yes4ko.com ftp' >> /etc/hosts
# vim /etc/postfix/main.cf
myhostname = www.yes4ko.com            (   FQDN)
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = yes4ko.com                    (     )
mydestination = www.yes4ko.com, localhost.localdomain    (       )
relayhost =                       (      domain,     ISP MTA    ,    !)
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 hash:/etc/postfix/access    (         postfix)
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = ipv4
relay_domains = yes4ko.com, localhost
:wq
# vim /etc/postfix/access
.yes4ko.com  OK            (   domain  postfix)
X.X.X.       REJECT        (  X.X.X.0/24  postfix)
:wq
# postalias hash:/etc/aliases        (    )
# postmap hash:/etc/postfix/access
# /etc/init.d/postfix reload  (        )
# /etc/init.d/postfix check   (   postfix        )
# /etc/init.d/postfix start   (   postfix   )
# /etc/init.d/postfix stop    (   postfix   )
# /usr/sbin/postqueue -p        (           )
 :
# mailq
# /etc/init.d/postfix flush   (                  )
 
2>: ネットワークアドレスを自動取得する
 
# vim /usr/sbin/getPubIP.sh        (        IP mail     )
#!/bin/sh
#Program: save as /usr/sbin/getPubIP.sh
#
DATE=$(date +'%Y-%m-%d %H:%M:%S')
curl ifconfig.me/ip > getip.txt 2>&1
echo $DATE >> getip.txt
tail -2 getip.txt| mail -s 'Today's Public IP Addr' [email protected]
:wq
 
3>: 設定 routine
 
# echo '07 */1 * * * root /usr/sbin/getPubIP.sh' >> /etc/crontab (   1         )
 
4>: Reserved for future use...5>: Reserved for future use...6>: Reserved for future use....7>: Reserved for future use….More About デビアン :  http://bbs.chinaunix.net/thread-3751791-1-1.htmlMore About Postfix: http://www.postfix.org/STANDARD_CONFIGURATION_README.啣唕null_client
転載先:https://blog.51cto.com/hackerwang/1404858