Skip to content

Instantly share code, notes, and snippets.

@thefury
Created August 23, 2018 18:39
Show Gist options
  • Select an option

  • Save thefury/404119bec8b8d7d8d1297b62b4723e7b to your computer and use it in GitHub Desktop.

Select an option

Save thefury/404119bec8b8d7d8d1297b62b4723e7b to your computer and use it in GitHub Desktop.
Wrap a command to perform jobs before and after
#!/bin/bash
# usage:
# - wrapper.sh do-list ls -la
# - wrapper.sh import-job /usr/local/bin/import param1 param2
TIMESTAMP=$(date +%s)
MONITOR_NAME=$1
shift 1
COMMAND=$@
echo "$MONITOR_NAME-$TIMESTAMP START"
$($COMMAND)
echo "$MONITOR_NAME-$TIMESTAMP STOP"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment