Skip to content

Instantly share code, notes, and snippets.

@tik0
Created April 19, 2019 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tik0/118cc11fee62b910190dc089e9e27cd8 to your computer and use it in GitHub Desktop.
Save tik0/118cc11fee62b910190dc089e9e27cd8 to your computer and use it in GitHub Desktop.
Periodic visit of StackOverflow website
#!/bin/bash
# Based on chromium, add the following 2 lines to `sudo crontab -e`
# 1 1 * * * rm /tmp/.org.chromium.Chromium.*
# 1 1 * * * rm -r /tmp/scoped_dir*
# Start a display (https://en.wikipedia.org/wiki/Xvfb)
export DISPLAY=:1
Xvfb :1 -screen 0 1024x768x16 &
PIDD=$!
# Get links
wget -O - https://www.stackoverflow.com | grep -oe "\"\/questions\/[[:digit:]]*\/[[:alnum:]-]*\"" | tr -d '"' | sed '1~2d' | sed "s#^#www\.stackoverflow.com#g" | head -n5 > so_questions.txt
# Visit links
for link in $(cat so_questions.txt); do
chromium-browser --disable-extensions --disable-plugins ${link} &
PID=$!
sleep 20
kill $PID
done
# Close the display
kill $PIDD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment