cron = CrontabParser(\`crontab -l\`)
cron.find_all{|row| puts row.cmd}
gives:
RuntimeError: invalid line HOME=/home/tamara
from /home/tamara/.rvm/gems/ruby-1.9.3-head/gems/crontab-parser-0.1.0/lib/crontab-parser/record.rb:52:in `times'
from /home/tamara/.rvm/gems/ruby-1.9.3-head/gems/crontab-parser-0.1.0/lib/crontab-parser/record.rb:13:in `cmd'
from (irb):9:in `block in irb_binding'
from /home/tamara/.rvm/gems/ruby-1.9.3-head/gems/crontab-parser-0.1.0/lib/crontab-parser.rb:25:in `each'
from (irb):9:in `find_all'
from (irb):9
from /home/tamara/.rvm/rubies/ruby-1.9.3-head/bin/irb:16:in `<main>'
For a crontab of:
# Time-stamp: <2012-12-05 00:40:52 tamara>
# See man 5 crontab for entry format
HOME=/home/tamara
LOGNAME=tamara
MAIL=tamara
# minute hour day-of-month month day-of-week command
# pop up a daily reminder list
0 6 * * * DDATE=/usr/bin/ddate NOTIFY=true /usr/bin/remind -q $HOME/.remind | DISPLAY=:0 /usr/bin/gxmessage -file - 1>/dev/null 2>&1
# snag the brainy quote of the day
0 0 * * * $HOME/bin/bqotdxmldecoder.pl
# play music for a wake up call
30 6 * * 1,2,3,4,5 DISPLAY=:0 /usr/bin/vlc /home/tamara/Music/Mirrorball.m3u 1>/dev/null 2>&1
version: ruby 1.9.3p335 (2012-12-11 revision 38315) [i686-linux]
gives:
For a crontab of:
version: ruby 1.9.3p335 (2012-12-11 revision 38315) [i686-linux]