added cron for ruby and twilio instance can be a local variable

This commit is contained in:
subhashsaran 2016-01-29 19:29:38 +05:30
parent f8478c42a4
commit cf4bb03e27
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -11,7 +11,7 @@ Dotenv.load
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 @@ her_number = '+xxx'
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}"
)