Skip to content

Instantly share code, notes, and snippets.

@hanikhan
Last active July 30, 2018 13:49
Show Gist options
  • Save hanikhan/1cbb5d79bc4a856633291afd4c61453b to your computer and use it in GitHub Desktop.
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
#!/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