Bash Script to Create a Bomgar Licensing Report

I recently showed a developer at work the Bomgar API so he can whip up some fancy reporting. But why should devs have all the fun?

Figuring out the sed part made my brain catch on fire.

# Author Greg Carriger
# Rep Console Usage file version v1
## Collect Data
wget --no-check-certificate\&password=examplepassword\&action=get_logged_in_reps
grep display_name command.ns* > user1
rm command.ns*
wget --no-check-certificate\&password=examplepassword\&action=get_logged_in_reps
grep display_name command.ns* > user2
rm command.ns*
usert=$(cat user1 user2 | sort -u | wc -l)
user1=$(cat user1 | wc -l)
user2=$(cat user2 | wc -l)
time=$(date +%s)
## Write Data
echo $usert $user1 $user2 > tempstats
cat tempstats | sed '$s|^|'"$time"' |' >> stats
## Clean up
rm user1 user2 tempstats

Not done yet.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s