Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl6
- use v6;
- my $CronFile = q:to/HERECRON/;
- # & - classic cron syntax
- # @ - frequency or timespan (every 30 minutes; with options: best moment within every 30 minutes)
- !bootrun(false)
- # Get Up
- #&mail(no) 00 14 * * 0,2,4-6 export DISPLAY=:0 && bash "/home/beck/Scripts/Justin.sh" 'Wake Up From 12:00 Nap (2:00)'
- #&mail(no) 00 10 * * 0-6 export DISPLAY=:0 && bash "/home/beck/Scripts/Justin.sh" 'Asa Dai Yo (6:00)'
- &mail(no) 58 4 25-31 8 2,4 export DISPLAY=:0 && amixer sset Master '50%'
- &mail(no) 58 4 * 9-12 2,4 export DISPLAY=:0 && amixer sset Master '50%'
- &mail(no) 00 5 25-31 8 2,4 export DISPLAY=:0 && bash "/home/beck/Scripts/Justin.sh" 'School At 6:00 (Leave by 5:45) (5:00)'
- &mail(no) 00 5 * 9-12 2,4 export DISPLAY=:0 && bash "/home/beck/Scripts/Justin.sh" 'School At 6:00 (Leave by 5:45) (5:00)'
- HERECRON
- grammar Cron::Gram {
- token Min { <TimeA> }
- token Hr { <TimeA> }
- token Dow { <TimeA> }
- token Day { <TimeA> }
- token Month { <TimeA> }
- token Yr { <TimeA> }
- token Unparse { # FIXME This should only be used durring testing, Never published.
- (\N+) {say "FAILED TO PARSE--<<$0>>"}
- }
- token CronVar {
- ( <[ \! \% ]> <Word>)
- }
- token CronArg {
- ( \& <Word>?)
- }
- token Cmd {
- <Word> [\h+<Word>]+
- }
- token Word {
- [ <Literal>
- || <Quote>
- || <-[#]> & \S]+
- }
- token Literal {
- \\ \N
- }
- token Quote {
- \' <-[\']>* \'
- | \" <-[\"]>* \"
- }
- token Comment {
- '#' (\N*)
- }
- token User { ... }
- token TimeA {
- [<Tnum> ',']* <Tnum>
- }
- token Tnum {
- '*' | [\d+ '-' \d+] | \d+
- }
- token CronJob {
- <CronArg> \s+ <Min> \s+ <Hr> \s+ <Dow> \s+ <Day> \s+ <Month> \s+ <Cmd>
- }
- rule TOP {
- #TODO [ <Comment> || [ <CronJob>||<CronVar> ] \h* \n? || <Unparse> ]+ #Needs to be tested first, Im tired so test with-geld. Note .perl isn't working as expectd.
- [[ <Comment>
- || <CronJob> <Comment>?
- || <CronVar>
- || <Unparse>
- ] \h* \n? ]+
- }
- }
- my $Parsed = Cron::Gram.parse($CronFile);
- say $Parsed;
- say $Parsed.perl;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement