Sunday, April 5, 2015

2009 (8) November (1) υ


On the day I made a little script to artificially food counter attendant increase the visits. Why is artificial? Yes, because people in it does not take part ... But it's cheating food counter attendant you say, and you will be right in principle, but sometimes it's just nice to see that your site is regularly someone comes, even if the car :) besides, it will increase Statistics on search engines and any ratings ... So, what we need in order to make the script come to life: 1) We need a browser, I strongly advise to use elinks, because it is one of the few text web browser capable to execute js. First, the text is useful not need a GUI to run (can be run on the server), and what we need js? A lot of counters using js. 2) You will need wget, for settings. 3) You will need programm notify-send, for krasivovogo output messages. The algorithm will Next 1. Go to the website and get the file reference (under the assignment, I mean a set of web sites / ip-address to which you want to go) 2. parse a file in it, each row is a link to the site. 3. go to the correct site 4. freeze at some time to load a page 5. complete the process initiated 6. go to the third paragraph food counter attendant and do the same thing for the next site and so will walk until the entire list. To elinks worked as it should, we need to make sure that it is compiled with the JS. Perform: elinks -version We are looking at the information received food counter attendant or ECMAScript Scripting (ECMAScript scripting engine), if you do this is that everything is fine, but if not (in my Ubuntu 9.04 was not) then download the latest version of the library put elinks apt-get install food counter attendant libmozjs-dev (it will carry firefox-3.5, if it's worth, but because this library is only needed to collect elinks, it will be the end to remove food counter attendant and restore your favorite FireFox-3.5 in place). Once collected elinks, we verify that we employ notify-send. notify-send temp If it is written that this team does not, put a package libnotify-bin (the so-called notify-send in Ubuntu). We pass to the script: #! / Bin / bash # Settings: # Enable / disable notification NOTIFY = "true" # Browser, through which we view the pages BROWSER = "elinks" # Icons that will be used for opoveschniya food counter attendant ICON = "- i / usr / share / icons / gnome / 32x32 / emblems / emblem-web.png "ICON_ERROR food counter attendant =" - i /usr/share/icons/gnome/32x32/emblems/emblem-important.png "ICON_PROGRESS =" - i / usr / share / icons / gnome / 32x32 / emblems / emblem-urgent.png "ICON_DONE =" - i /usr/share/icons/gnome/32x32/emblems/emblem-default.png "# Time to download and find at page # ( if you have a slow internet connection, to increase the time required) sleeptime = 15 # The path to the file with the task FILEHOST = "http://www.nol1ght.ru/" # The name of the file with the task FILE = "websites.txt" # delete files from specifying if it is rm $ FILE # Get the file with the task wget $ FILEHOST $ FILE # Proverryaem presence of a file and its readability if [! -f $ FILE]; then if ("$ NOTIFY" = "true"); then DISPLAY =: 0.0 notify-send $ ICON_ERROR "nol1ght's GoToTheLink" "ERROR: $ FILE does not exists" fi exit 1 elif [! -r $ FILE]; then if ("$ NOTIFY" = "true"); then DISPLAY =: 0.0 notify-send $ ICON_ERROR "nol1ght's GoToTheLink" "ERROR: food counter attendant can not read $ FILE" fi exit 2 fi # Create an array that will put links from our job LINKSARRAY [0] = "" # Create the counter COUNTER = 0 # start line reading file while read line do # writes the string food counter attendant into an array LINKSARRAY [$ COUNTER] = $ line # counter increases by 1 COUNTER = $ (expr $ COUNTER + 1) done <$ FILE # Write the number of jobs len = $ (expr $ COUNTER - 1) # Output the privetsvennoe message about the script if ("$ NOTIFY" food counter attendant = "true"); then DISPLAY =: 0.0 notify-send food counter attendant $ ICON "nol1ght's GoToTheLink" "nol1ght's visits script 'gotothelink' 0.1 is working with parametrs: Browser = $ BROWSER food counter attendant Sleeptime = $ sleeptime Websites = $ {# LINKSARRAY food counter attendant [*]}" fi # Reset the counter COUNTER = 1 # begins to read the array for website in $ {LINKSARRAY [*]} do # Go to the browser food counter attendant on the site you want $ BROWSER $ website & # Remember the process number pid = $! # We are waiting for a specified time before sleep $ sleeptime # completes the process kill -TERM $ pid # displays a message on the work done if ("$ NOTIFY" = "true"); then # Calculate the percentage passed sites let math = ($ COUNTER * 100) / $ {# LINKSARRAY [*]} # Increment the counter passed sites COUNTER = $ (expr $ COUNTER + 1) to alert the user # DISPLAY =: 0.0 notify-send $ ICON_PROGRESS "nol1ght's GoToTheLink" "DONE: food counter attendant $ math%" fi done # displays a message about the successful food counter attendant completion of the work if ("$ NOTIFY" = "true"); then DISPLAY food counter attendant =: 0.0 notify-send $ ICON_DONE "GoToTheLink" "The program is done, it has visited" $ {# LINKSARRAY [*]} "websites."; fi # Remove the resulting file with the task rm $ FILE add skpript in CZK, open crontab: crontab -e and enter the line: 40 * * * * / home / nol1ght food counter attendant / gotothelink Now, every 40 minutes, the script will be selected to attend our sites. Here sobstenno and all ... I hope it will be someone useful / interesting. source: gotothelink websites.txt
Comments
2009 (8) November (1) υ

No comments:

Post a Comment