Tag: bash

Tweeting แบบดิบๆ ผ่าน Linux Command Line

เมื่อกี้เข้า linuxtoday.com ไปเจอทิปเด็ดๆ ใน junauza.com เรื่อง Follow Me: Tweeting from the Linux Command Line อ่านแล้วน่าสนใจดี และหลังจากลองแล้วก็ได้ผลครับเลยนำมาบอกต่อ

ขั้นตอนเขามีอยู่ว่า
1. ติดตั้ง curl

mrgill@mrgill-laptop:~$ sudo apt-get install curl

2. สร้างไฟล์ชื่อ twitter ไว้ใน /usr/bin/ ด้วย text editor ที่ชอบในตัวอย่างเขาใช้ gedit แต่ผมชอบ nano

mrgill@mrgill-laptop:~$ sudo nano /usr/bin/twitter

จากนั้นนำโค้ดด้านล่างไปวาง

curl --basic --user "yourusername:yourpasswd" --data-ascii "status=`echo $@|tr ' ' '+'`" "http://twitter.com/statuses/update.json" -o /dev/null; echo Message Sent!

*อย่าลืมเปลี่ยน yourusername กับ yourpasswd เป็นของ twitter ของคุณ (กด Ctrl + O เพื่อบันทึก และกด Ctrl + X เพื่อออก)

3. กำหนดสิทธิ์ให้ /usr/bin/twitter สามารถรันได้
(more…)

Leave a Comment December 30, 2009

Server Down รู้ได้ทันทีผ่าน SMS แถมฟรีด้วย

ก่อนอื่นขอหาวยาวๆ ก่อนกล่าวสวัสดีท่านผู้อ่านทุกท่าน  เมื่อคืนบ้าพลังอะไรไม่รู้อยากเขียน script ส่ง sms เตือนเมื่อ server down ที่จริงชาวบ้านเค้าก็ทำขายกันเยอะแยะ แต่หลังจากที่ผมได้ใช้ Google Calendar แล้วให้มันส่ง sms เตือนแถมฟรีอีก ก็เลยคิดอยากใช้ประโยชน์จากมันเพิ่มเติมก็ค้นๆ  Google อีกเช่นเคยครับ ไปเจอบทความใน ThaiAdmin เรื่อง google calendar sms ที่ท่าน smartsoft เขียนไว้ก็เลยลองโหลด Libraries Google Calendar SMS มาเล่นดูบ้าง ซึ่งเมื่อลองดูแล้วก็ถือว่าใช้งานง่ายทีเดียวเลยเอามาโมต่อ โดยให้ Shell Script เป็นตัว Submit form แทน

ความสามารถของ Script

1. ส่ง sms แจ้งเตือนเมื่อ ping ไม่เจอ server
2. เก็บ log ในตัว เพราะทุกครั้งที่มันส่ง sms มันจะไปเพิ่ม Event ใน Google Calendar ทำให้เราเข้าไปตรวจสอบย้อนหลังได้
3. ไม่ต้องเสียเงินค่าส่ง SMS แม้แต่น้อย (พี่ Google เค้าใจดี)

มาดูขั้นตอนการทำกัน

ก่อนอื่นเราก็ต้องไป Verify เบอร์มือถือใน Google Calendar ก่อนครับ ขออนุญาตท่าน smartsoft ทำรูปใหม่นะครับ
1. ขั้นแรก ล็อกอินเข้า Google Calendar http://www.google.com/calendar ก็ใช้ User ของ Gmail นั้นแหละครับ
ล็อกอินแล้วคลิกที่ Settings เพื่อไปปรับเมนูให้เป็นภาษาไทย (หากใครเป็นภาษาไทยอยู่แล้วข้ามไปขั้นตอนต่อไปได้เลย)

คลิก Settings

2. เลือก Language ให้เป็น ภาษาไทย แล้วกด Save

เลือก ภาษาไทย

(more…)

30 Comments December 11, 2009


Recent Entries

Random Posts

Social Network

Tag Cloud

Calendar

March 2010
S M T W T F S
« Feb    
 123456
78910111213
14151617181920
21222324252627
28293031  

RSSTwitter: imrgill

RSS LinuxDotSothorn

RSS UbuntuClub

RSS Blognone

Tag

ภาษาไทย 2009 adobe amsn antivirus apt-get bash chat clip dns entertainment Facebook firefox Forward mail free google graphic grave accent How to howto im install Internet karmic keyboard Linux logout monitoring operating system os Programming recovery script Server shell script sms Social network Software themes troubleshooting twitter Ubuntu utility virtualization Windows

Categories

Archives

Blogroll

Meta

 

You need to log in to vote

The blog owner requires users to be logged in to be able to vote for this post.

Alternatively, if you do not have an account yet you can create one here.

Powered by Vote It Up

Get Adobe Flash playerPlugin by wpburn.com wordpress themes