From cf4bb03e2787e73e7a85d186c71860c2b5211a1c Mon Sep 17 00:00:00 2001 From: subhashsaran Date: Fri, 29 Jan 2016 19:29:38 +0530 Subject: [PATCH] added cron for ruby and twilio instance can be a local variable --- README.md | 6 ++++++ smack_my_bitch_up.rb | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bfda095d..a9282859 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,12 @@ GMAIL_PASSWORD=password For Ruby scripts you need to install gems: `gem install dotenv twilio-ruby gmail` +## Cron jobs for Ruby + +`'" 20 21 * * 1-5 /usr/local/bin/ruby /local/myuser/rubyscript/smack_my_bitch_up.rb >> +/local/myuser/rubyscript/log.txt "'` +and remaining crons in same way for Ruby. + ## Cron jobs ```sh diff --git a/smack_my_bitch_up.rb b/smack_my_bitch_up.rb index b81a3349..5eedc2a9 100755 --- a/smack_my_bitch_up.rb +++ b/smack_my_bitch_up.rb @@ -11,7 +11,7 @@ TWILIO_ACCOUNT_SID = ENV['TWILIO_ACCOUNT_SID'] TWILIO_AUTH_TOKEN = ENV['TWILIO_AUTH_TOKEN'] -@twilio = Twilio::REST::Client.new TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN +twilio = Twilio::REST::Client.new TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN # Phone numbers my_number = '+xxx' @@ -20,11 +20,13 @@ reason = [ 'Working hard', 'Gotta ship this feature', - 'Someone fucked the system again' + 'Someone fucked the system again', + 'Gotta fix bugs urgently', + 'Gotta scale up the system' ].sample # Send a text message -@twilio.messages.create( +twilio.messages.create( from: my_number, to: her_number, body: "Late at work. #{reason}" )