@ ECHO OFF title F@H Stats Uploader echo =========================================== echo F@H Stats Uploader echo Version: 0.5 beta 4/13/2009 echo Authors: usa2k, MstrBlstr echo Dependencies: Windows cmd.exe or command.exe. echo cat.exe, grep.exe, sed.exe, tail.exe, cut.exe echo command line utilities from echo http://www.unxutils.sourceforge.net/ echo Discussed here: echo http://www.dslreports.com/forum/remark,17951702 echo cURL utility discussed here: echo http://www.dslreports.com/forum/remark,17237164 echo OS: Windows XP, Vista echo Tested on: Windows XP Pro SP3, Vista Business SP1 echo Purpose: To create the files needed for the echo Monitor scripting engine, and echo upload them to the FAH-Tool monitor site. echo =========================================== :: :: ============================Comment================================= :: We add this just to make sure that it starts :: in the right directoy, no matter where the :: batch script is run from. :: Naturally this assumes that the path below :: actually exists. :: -------------------Code---------------------- cd /D "C:\scripts\fahtool" :: ---------------------------------------------- :: Or something like :: cd /D "D:\Folding\Stats :: Really it can be any directory that you want the files :: to be stored in. Even something like: :: cd /D "C:\WINDOWS\Temp" :: ====================================================================== :: :: !!!!!!!!!!!!!!!!!!!!!!!! IMPORTANT NOTE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :: The order of these commands is CRITICAL!!! :: Only change the paths to your folding directories and :: the # of the Foldy being hosted. :: The format for the files that are to be uploaded are *-*-unitinfo.txt :: and *-*-FAHlog.txt :: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! :: :: ++++++++++++++++++++++++++Foldy 6-1++++++++++++++++++++++++++ :: ===========================Comment=========================== :: I am going to add in some comments here, so you will know what :: each line of code does. Each commnet will be for the line of :: code directly below it. :: ============================================================= :: This line of code copies the clients unitinfo.txt file to the stats directory :: as unitinfo1.txt. :: cat "C:\FAH1\unitinfo.txt" > .\unitinfo1.txt :: :: The next two lines grab the username and team number from the FAH1 dirs :: client.cfg file, and appends them to the unitinfo1.txt file. :: cat "C:\FAH1\client.cfg" | grep "username=" >> .\unitinfo1.txt cat "C:\FAH1\client.cfg" | grep "team=" >> .\unitinfo1.txt :: :: The next two entries append the Watts: and CPU: info to the unitinfo1.txt file. :: The CPU: and Watts: part MUST remain. For the Watts: it would be the total wattage :: used by that system. In the case of a multi core system, divide by the # of :: clients running. For CPU: you can put whatever looks good to you. :: echo Watts: 27 >> .\unitinfo1.txt echo CPU: Dell i530 Q6600 @2.4GHz 6.20 Uni Client >> .\unitinfo1.txt :: :: This grabs the Tag: line from the clients unitinfo.txt file, and :: appends it to the end of the unitinfo1.txt file. :: cat "C:\FAH1\unitinfo.txt" | grep "Tag:" >> .\unitinfo1.txt :: :: This takes the unitinfo1.txt file, does some fancy changes to make :: things compatible with the monitor scripting engines. Then creates a :: new unitinfo1_2.txt file (Necessary evil, as we are trying to create :: one file in the end, that will work well with both monitoring engines). :: cat .\unitinfo1.txt | sed "s/username=/Fahusername: /";"s/team=/Fahteamid: /" > .\unitinfo1_2.txt :: :: This line removes the first instance of the Tag: line. It then creates :: the final unitinfo.txt file that will be uploaded to both monitor sites. :: Thanks to to usa2k, for the sed code for this bit. :: cat .\unitinfo1_2.txt | sed "1,/Tag:/{//d;}" > .\6-01-unitinfo.txt :: :: Ahhhh, the easy one! Wish that it was all this simple. :: Grabs the last 1000 lines from the clients FAHlog.txt file, and creates :: the file to upload. :: tail -1000 "C:\FAH1\FAHlog.txt" > .\6-01-FAHlog.txt :: :: +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ :: :: I have commented out all but the first instance. Left the other three :: just so it would be easier to add them if needed. Just edit for the :: correct foldy blade info, and un-comment the ones that you need to run. :: :: ++++++++++++++++++++++++++Foldy 6-2++++++++++++++++++++++++++ :: cat "C:\FAH2\unitinfo.txt" > .\unitinfo2.txt :: cat "C:\FAH2\client.cfg" | grep "username=" >> .\unitinfo2.txt :: cat "C:\FAH2\client.cfg" | grep "team=" >> .\unitinfo2.txt :: echo Watts: 27 >> .\unitinfo2.txt :: echo CPU: Dell i530 Q6600 @2.4GHz 6.20 Uni Client >> .\unitinfo2.txt :: cat "C:\FAH2\unitinfo.txt" | grep "Tag:" >> .\unitinfo2.txt :: cat .\unitinfo2.txt | sed "s/username=/Fahusername: /";"s/team=/Fahteamid: /" > .\unitinfo2_2.txt :: cat .\unitinfo2_2.txt | sed "1,/Tag:/{//d;}" > .\6-02-unitinfo.txt :: tail -1000 "C:\FAH2\FAHlog.txt" > .\6-02-FAHlog.txt :: :: ++++++++++++++++++++++++++Foldy 6-3++++++++++++++++++++++++++ :: cat "C:\FAH3\unitinfo.txt" > .\unitinfo3.txt :: cat "C:\FAH3\client.cfg" | grep "username=" >> .\unitinfo3.txt :: cat "C:\FAH3\client.cfg" | grep "team=" >> .\unitinfo3.txt :: echo Watts: 27 >> .\unitinfo3.txt :: echo CPU: Dell i530 Q6600 @2.4GHz 6.20 Uni Client >> .\unitinfo3.txt :: cat "C:\FAH3\unitinfo.txt" | grep "Tag:" >> .\unitinfo3.txt :: cat .\unitinfo3.txt | sed "s/username=/Fahusername: /";"s/team=/Fahteamid: /" > .\unitinfo3_2.txt :: cat .\unitinfo3_2.txt | sed "1,/Tag:/{//d;}" > .\6-03-unitinfo.txt :: tail -1000 "C:\FAH3\FAHlog.txt" > .\6-03-FAHlog.txt :: :: ++++++++++++++++++++++++++Foldy 6-4++++++++++++++++++++++++++ :: cat "C:\FAH4\unitinfo.txt" > .\unitinfo4.txt :: cat "C:\FAH4\client.cfg" | grep "username=" >> .\unitinfo4.txt :: cat "C:\FAH4\client.cfg" | grep "team=" >> .\unitinfo4.txt :: echo Watts: 27 >> .\unitinfo4.txt :: echo CPU: Dell i530 Q6600 @2.4GHz 6.20 Uni Client >> .\unitinfo4.txt :: cat "C:\FAH4\unitinfo.txt" | grep "Tag:" >> .\unitinfo4.txt :: cat .\unitinfo4.txt | sed "s/username=/Fahusername: /";"s/team=/Fahteamid: /" > .\unitinfo4_2.txt :: cat .\unitinfo4_2.txt | sed "1,/Tag:/{//d;}" > .\6-04-unitinfo.txt :: tail -1000 "C:\FAH4\FAHlog.txt" > .\6-04-FAHlog.txt :: ------------------Uploading Files-------------------------- sleep 5 :: ==================Comment==================== :: Here we upload the files using curl, to fah-tool.org. Making sure that :: everything goes into the correct user dir. :: You need to edit in the user:pw credentials, and add in any other files :: that you want to upload. IE... {6-01-unitinfo.txt,6-01-FAHlog.txt,6-02-unitinfo.txt,6-02-FAHlog.txt} :: -------------------Code---------------------- :: You can un-comment the echo line, if you want to see it in the cammand window. :: echo Uploading files to usa2k.com/f06/ :: curl -# -m 60 -T {6-01-unitinfo.txt,6-01-FAHlog.txt} -u user:PW ftp://ftp.usa2k.com/f06/ ::-------------------------------------------- :: ::----------------START F-M MOD----------------- :: This part has been added to upload the :: files needed for the FoldyMonitor Site. :: You need to edit in the user:pw (X2) ftp credentials. :: Also remove the ":: " from the front of the :: lines starting with "echo", and "curl", for this MOD :: to work. Again, only list the files that you want to upload :: seperated by a , as shown above. ::---------------------------------------------- :: :: echo Uploading *-**-unitinfo.txt files to foldy.nozero.org :: :: curl -# -m 60 -T {6-01-unitinfo.txt} -u user:PW ftp://ftp.foldy.nozero.org/ :: :: echo Uploading 4 FAHlog.txt files to foldy.nozero.org/data/ :: :: curl -# -m 60 -T {6-01-FAHlog.txt}-u user:PW ftp://ftp.foldy.nozero.org/data/ ::------------------END F-M MOD--------------------