Created
August 23, 2018 18:39
-
-
Save thefury/404119bec8b8d7d8d1297b62b4723e7b to your computer and use it in GitHub Desktop.
Wrap a command to perform jobs before and after
This file contains hidden or 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 | |
| # 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