You can use twitter from your Raspberry Pi implementing one or more cronjobs
- Ruby version >= 1.9.3
- Rubygems
- bundler(may need to be root):
gem install bundler
- Some coffee
-
First sign up at http://dev.twitter.com and create a aplication
-
Now can use your
consumer key
,consumer secret
,access token
asoauth_token
andaccess token secret
asoauth_token_secret
for config the file "config/config.rb" -
Get the root folder should be called "raspberry-tweet" and run the command
bundle install
-
Creates a MySQL database and configures the file "config/database.yml"
-
Now create migrations with
rake db:create
rake db:migrate
- Enjoy
- Say the current time
ruby tells_time.rb
- Post a note from google news
ruby news.rb
- Do some re-tweet related to raspberry
ruby retweet.rb
- Say hello to new followers
ruby followers.rb
Make a crontab that say hello every 45 minutes and record the output in the file log-followers.log.
Assuming that your folder is inside /home/pi
- Edit the file containing instructions crontab
crontab -e
- Enter the following line at end of file
45 * * * * ruby /home/pi/raspberry-tweet/followers.rb >> /home/pi/log-followers.log 2>&1
To save press CTRL + O and then ENTER
- Now, execute
crontab -l
you should see something like the following
....
45 * * * * ruby /home/pi/raspberry-tweet/followers.rb >> /home/pi/log-followers.log 2>&1