Holy Bash!

the_Grinchthe_Grinch Member Posts: 4,165 ■■■■■■■■■■
I know I've been posting a lot about work lately, but I have to say for the first time I feel like I am doing meaningful work that is enjoyable. Today I wrote my first complete bash script. I have a long range of projects that I need to complete and one of them is to automate the checking of a series of terms and conditions. We are required to be notified when they change, but as we all know a method to monitor it independently of just going on the word of the companies we regulate is ideal. Tonight I completed a script that goes to one of the websites, copies the page, pulls out the lines related to the terms and conditions that are read by consumers, and finally compares it to another file we have with what they have been approved for.

My end goal is to make a web interface that shows the last time it ran, pass/fail (with an email alert on failures), why it failed, the next time it will run, and a manual run button. Kicking butt and taking names!
WIP:
PHP
Kotlin
Intro to Discrete Math
Programming Languages
Work stuff

Comments

  • YFZbluYFZblu Member Posts: 1,462 ■■■■■■■■□□
    Congratulations! Completing the first useful automation project is an amazing feeling.
  • NovaHaxNovaHax Member Posts: 502 ■■■■□□□□□□
    Bash is the best!!!
  • Master Of PuppetsMaster Of Puppets Member Posts: 1,210
    Now that's pretty cool! Good job icon_thumright.gif
    Yes, I am a criminal. My crime is that of curiosity. My crime is that of judging people by what they say and think, not what they look like. My crime is that of outsmarting you, something that you will never forgive me for.
  • EdTheLadEdTheLad Member Posts: 2,111 ■■■■□□□□□□
    Funny, i wrote a bash script about 2 month ago that would place combination bets on soccer, i used it to bet on accumulators varying the goals scored across a handful of games. Still didn't win, so i must continue in networking icon_smile.gif .
    Networking, sometimes i love it, mostly i hate it.Its all about the $$$$
  • phoeneousphoeneous Member Posts: 2,333 ■■■■■■■□□□
    Good stuff man, post it up and share the wealth!

    I'm working on an expect script to mod a bunch of cisco devices.
  • EdTheLadEdTheLad Member Posts: 2,111 ■■■■□□□□□□
    I used a macro addon in firefox "iOpus iMacros" to automate this.
    You need to modify URL,array variables and possibly a couple of other things with a find replace.
    The iMacros addon allows you to record browsing of the website and hence give you the variables required, i.e. this can be used on any kind of betting.
    If you want the full script send me a pm, too large to paste here.

    Was perl, thought it was bash, but pretty similar.

    #!/usr/bin/env perl
    use warnings;


    my $URL = "URL GOTO=http://www.sportsbet.com.au/betting/soccer/italy/italian-serie-a#";
    my $MAX = 3;
    my $x = 1;

    my $a = 1;
    my $b = 1;
    my $c = 1;
    my $d = 1;
    my $e = 1;

    #Liverpool vs Fulham 2-0,2-1,3-1
    #Southmapton vs Hull 1-0,2-0,2-1
    #Norwich vs Westham 1-0,0-0,0-1
    #Tottenham vs New Castle 1-0,0-0,0-1
    #Man U vs Arsenal 0-1,1-1,1-2



    my @Team1 = ("NULL","157","160","166");
    my @Team2 = ("NULL","205","208","211");
    my @Team3 = ("NULL","256","257","258");
    my @Team4 = ("NULL","307","308","309");
    my @Team5 = ("NULL","462","464","468");

    print "VERSION BUILD=8530828 RECORDER=FX" . "\n";
    print "TAB T=1" . "\n";
    print "$URL" ."\n";

    while ( $x <= $MAX ) {

    print "TAG POS=$Team1[$a] TYPE=SPAN ATTR=CLASS:team-name<SP>ib" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=$Team2[$b] TYPE=SPAN ATTR=CLASS:team-name<SP>ib" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=$Team3[$c] TYPE=SPAN ATTR=CLASS:team-name<SP>ib" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=$Team4[$d] TYPE=SPAN ATTR=CLASS:team-name<SP>ib" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=$Team5[$e] TYPE=SPAN ATTR=CLASS:team-name<SP>ib" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:betSlipInfoForm ATTR=TYPE:text&&ONBLUR:betslip.stake_onblur(this.id);&&ONFOCUS:betslip.stake_onfocus(this.id);&&ONCHANGE:betslip.stake_changed(this.id,<SP>false)&&ONKEYUP:betslip.stake_changed(this.id,<SP>true)&&VALUE:0.00&&ID:stake_type_ACC5&&CLASS:bs-stake-input<SP>betslipCombinedUnitInput CONTENT=.02" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=4 TYPE=TD ATTR=COLSPAN:4" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=1 TYPE=SPAN ATTR=CLASS:placebet" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=268 TYPE=DIV ATTR=*" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=150 TYPE=DIV ATTR=*" . "\n";


    $x++;
    $e++;

    }
    $x = 1;

    $a = 1;
    $b = 1;
    $c = 1;
    $d = 2;
    $e = 1;

    while ( $x <= $MAX ) {


    print "TAG POS=$Team1[$a] TYPE=SPAN ATTR=CLASS:team-name<SP>ib" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=$Team2[$b] TYPE=SPAN ATTR=CLASS:team-name<SP>ib" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=$Team3[$c] TYPE=SPAN ATTR=CLASS:team-name<SP>ib" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=$Team4[$d] TYPE=SPAN ATTR=CLASS:team-name<SP>ib" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=$Team5[$e] TYPE=SPAN ATTR=CLASS:team-name<SP>ib" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=1 TYPE=INPUT:TEXT FORM=ID:betSlipInfoForm ATTR=TYPE:text&&ONBLUR:betslip.stake_onblur(this.id);&&ONFOCUS:betslip.stake_onfocus(this.id);&&ONCHANGE:betslip.stake_changed(this.id,<SP>false)&&ONKEYUP:betslip.stake_changed(this.id,<SP>true)&&VALUE:0.00&&ID:stake_type_ACC5&&CLASS:bs-stake-input<SP>betslipCombinedUnitInput CONTENT=.02" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=4 TYPE=TD ATTR=COLSPAN:4" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=1 TYPE=SPAN ATTR=CLASS:placebet" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=268 TYPE=DIV ATTR=*" . "\n";
    print "WAIT SECONDS=5" . "\n";
    print "TAG POS=150 TYPE=DIV ATTR=*" . "\n";


    $x++;
    $e++;

    }
    Networking, sometimes i love it, mostly i hate it.Its all about the $$$$
  • maharalielmaharaliel Member Posts: 119
Sign In or Register to comment.