Bashtools
Several bash scripts to make life easier
Install / Use
/learn @huandu/BashtoolsREADME
Welcome to send me feedback in github or "@huandu":http://twitter.com/huandu on twitter.
h2. List of tools
- <code>remote</code>
- <code>colorize</code>
- <code>platform</code>
h3. The remote script runner: <code>remote</code>
If you usually run remote script with ssh or tools using ssh (e.g. pssh and onall), you will find it's hard to stop remote script manually. It means, even if your ssh connection is down, the remote running script will keep going until it exits normally. If the remote script consumes lots of resource, this default behavior may cause unconscious bad effect.
This script is designed to resolve this issue. Basically, use it like 'nice'.
Here is a sample.
<code> ssh user@your.host remote tail -f your-log </code>With <code>remote</code>, you can safely stop this ssh connection any time.
h3. Simple command line output highlighter: <code>colorize</code>
Colorize is similar to grep with <code>--color</code> option, except that it's a bit more user-friendly. For people like me who don't want to remember XTerm color code, colorize can save you.
Here is how to use it.
<code> tail -f your.log.file | colorize yellow '^FATAL:' </code>h3. Simple platform detection script: <code>platform</code>
Platform script is to detect and print platform information in bash.
Sample usage.
<code>platform</code>
Above command will print following information on MacOSX.
<pre> type: darwin kernal_version: 12.4.0 dist: Darwin dist_version: 12.4.0 </pre>And following output is the result on Ubuntu server.
<pre> type: linux-gnu kernal_version: 3.5.0-23-generic dist: Ubuntu dist_version: 12.04 </pre>