Created
August 29, 2013 13:05
-
-
Save AndiH/6377814 to your computer and use it in GitHub Desktop.
Count number of Chrome tabs (=processes, since every tab runs in its own process) and printout to file
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 | |
# Will print to amount of currently running chrome processes to a file | |
# Run every 5 minutes via cronjob a lá */5 * * * * ./Users/Andi/Desktop/countChrome.sh | |
# Or, better on OS X, use launchd | |
# Note: On Linux, there's a different pgrep version, use the first, commented NUMBEROFCHROMEPROCESSSES (untested) | |
# | |
# 29.8.2013 Andreas Herten http://www.andreasherten.de/ | |
PATH=/usr/local/bin:/usr/bin:/bin | |
#NUMBEROFCHROMEPROCESSES=$(pgrep -i -c chromium | sed 's/^ *//g') | |
NUMBEROFCHROMEPROCESSES=$(pgrep -i chrome | wc -l | sed 's/^ *//g') | |
TODAY=$(date +"%Y-%m-%d %H:%M:%S") | |
OUTPUTFILE="chromeProcesses.csv" | |
ABSOLUTEDIR="/Users/Andi/Desktop" | |
echo "$TODAY"";""$NUMBEROFCHROMEPROCESSES">>$ABSOLUTEDIR/$OUTPUTFILE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Outdated! And wrong! Go there: https://github.com/AndiH/QuantifiedSelf/tree/master/chromeProcesses