Last active
July 30, 2018 13:49
-
-
Save hanikhan/1cbb5d79bc4a856633291afd4c61453b to your computer and use it in GitHub Desktop.
Log BrowserStackLocal process details to a log file using shell script on MAC OS X and Linux systems
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 | |
#To start logging output of grep command every 10 seconds, use: | |
#Mac: sh logging.sh 10 | |
#Linux: bash logging.sh 10 | |
if [ "$1" != "" ]; then | |
re='^[0-9]+$' | |
if ! [[ $1 =~ $re ]] ; then | |
echo "Invalid Argument" >&2; exit 1 | |
fi | |
# Message to stop logging | |
echo "Hit [CONTROL+C] to stop logging!" | |
# Start Logging | |
while : | |
do | |
ps aux | grep browserstack | grep -v grep | sed "s/^/$(date)/" >> bslocal.log | |
sleep $1 | |
done | |
else | |
echo "Please pass time in seconds as command line argument" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment