Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions smack_my_bitch_up.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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}"
)

Expand Down