Created
April 19, 2019 19:59
-
-
Save tik0/118cc11fee62b910190dc089e9e27cd8 to your computer and use it in GitHub Desktop.
Periodic visit of StackOverflow website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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