I have a ruby script called automated_script.rb
I also have a shell script called automated_script.sh
Both of these files are located on my desktop, for now.
whenever I run ruby automated_script.rb
, the script works as expected (all it does is send a text message using the twilio api)
This is what I have in automated_script.sh
#!/bin/zsh
/Users/angelgarcia/.rvm/rubies/ruby-2.6.3/bin/ruby /Users/angelgarcia/Desktop/automated_script.rb
when I navigate to my desktop in the terminal and run, ./automated_script.sh
it works.
when I simply run:
/Users/angelgarcia/.rvm/rubies/ruby-2.6.3/bin/ruby /Users/angelgarcia/Desktop/automated_script.rb
in the terminal, this works too.
However, in my crontab, I have this:
* * * * * /Users/angelgarcia/Desktop/automated_script.sh
This does not work as expected.
Simply running this works: /Users/angelgarcia/Desktop/automated_script.sh
But for some reason, when I put it in the crontab, it doesn't run every minute.
When I run crontab -l
in my terminal, I get this:
* * * * * /Users/angelgarcia/Desktop/automated_script.sh
So I know it's active.
Any help is appreciated, thanks!
EDIT
here is whats inside of my ruby file
require 'twilio-ruby'
account_sid = 'xxx'
auth_token = 'xxx'
@client = Twilio::REST::Client.new account_sid, auth_token
@client.messages.create(
from: '999',
to: '999',
body: message
)