GET bot.whatismyipaddress.com
nano ~/getip
GET bot.whatismyipaddress.com > .myip echo "" >> .myip sleep 1 GET bot.whatismyipaddress.com >> .myip echo "" >> .myip sleep 1 GET bot.whatismyipaddress.com >> .myip echo "" >> .myip
sh ~/getip
cat ~/.myip
92.122.18.135 92.122.18.135 92.122.18.135
cat ~/.myip | msmtp johnny@whitehouse.gov
cat ~/.myip | mail johnny@whitehouse.gov
nano ~/getip
echo Subject:MaBoxMeParle > .myip GET http://www.formyip.com/ | grep "Your IP is" |awk '{print $6}'|sed 's/</ /g'|awk '{print $1}' >> .myip echo "" >> .myip sleep 1 GET http://bot.whatismyipaddress.com >> .myip echo "" >> .myip cat .myip | msmtp johnny@whitehouse.gov
chmod 700 ~/getip
sh ~/getip
~$ cat .myip
Subject:MaBoxMeParle 86.178.64.39 86.178.64.39
Le système crontab intégré à unix/linux permet une programmation simple de l'exécution de commandes et scripts.
crontab -l > cron
nano cron
23 8,12,15,18 1-5 * * sh /home/johnny/getip # à 08:23 12:23 15:23 et 18:23, du 1er au 5ème jour de la semaine # parce que les soirs et week-end je suis à la maison # et que c'est encore plus simple de récupérer mon IP
crontab ~/cron
crontab -l
... 23 8,12,15,18 1-5 * * sh /home/johnny/getip ...
(23 8,12,15,18 1-5 * *) donne bien les jours 1 à 5 dans la semaine alors que (23 8,12,15,18 * * 1-5) donne les jours 1 à 5 du mois
rm ~/cron
kerkael création de la page le 23/08/2009