The workflow:
1) cronjob runs a bash script under trusty, with `jsub -l release=trusty ~/exec.sh`
2) bash script exports the Ruby bins to PATH, sets the local ruby, then runs the ruby script, via:
```
export PATH="$HOME/.rbenv/bin:$PATH"
export PATH=$PATH:/data/project/musikbot/.rbenv/versions/2.1.0-dev/bin
rbenv local 2.1.0-dev
cd ~/MusikBot
ruby -d core.rb
```
Sometimes this is successful, sometimes it is not. There are two error logs, `dash.err` for the cron and `exec.err` for the bash script. Both have similar output:
```
Exception `LoadError' at /data/project/musikbot/.rbenv/versions/2.1.0-dev/lib/ruby/2.1.0/rubygems.rb:1194 - cannot load such file -- rubygems/defaults/operating_system
Exception `LoadError' at /data/project/musikbot/.rbenv/versions/2.1.0-dev/lib/ruby/2.1.0/rubygems.rb:1203 - cannot load such file -- rubygems/defaults/ruby
Exception `LoadError' at /data/project/musikbot/.rbenv/versions/2.1.0-dev/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- mediawiki-gateway
Exception `LoadError' at /data/project/musikbot/.rbenv/versions/2.1.0-dev/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- unicode
Exception `LoadError' at /data/project/musikbot/.rbenv/versions/2.1.0-dev/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55 - cannot load such file -- unicode/2.1/unicode_native
Exception `LoadError' at /data/project/musikbot/.rbenv/versions/2.1.0-dev/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:141 - cannot load such file -- unicode/2.1/unicode_native
Using Ext extension for JSON.
...
Exception `Errno::ENOENT' at /data/project/musikbot/.gem/ruby/2.1.0/gems/netrc-0.10.3/lib/netrc.rb:43 - No such file or directory @ rb_file_s_stat - /data/project/musikbot/.netrc
Exception `OpenSSL::SSL::SSLErrorWaitReadable' at /data/project/musikbot/.rbenv/versions/2.1.0-dev/lib/ruby/2.1.0/openssl/buffering.rb:182 - read would block
...
Exception `LoadError' at ruby - Permission denied -- core.rb
ruby: Permission denied -- core.rb (LoadError)
```
This output is from the `-d` flag used when running the Ruby script. Without the debugging output you see only `ruby: Permission denied -- core.rb (LoadError)`. It is unclear if this is actually a permissions issue as I've made everything in the entire directory read/write/exec with `chmod 0777`.
This issue happened to me about two weeks ago, and somehow resolved itself. However, that time I was getting the error about `permission denied` when attempting to write to `perm_clerk.log` which is the log file for the Ruby script. That file also had full rwx permissions. I'm not sure if that issue is related to this one, but thought I'd mention it.
Any help is greatly appreciated!