Post thumbnail of Use multiple processors in bash by running commands in parallel
15 January 2010
Continue reading Use multiple processors in bash by running commands in parallel

Use multiple processors in bash by running commands in parallel

Here’s a short bash script to parallelize your jobs. There are utilities already written for just this type of thing, but forget xargs. Check out xjobs instead.

Post thumbnail of subprocess.popen and static define in Python
13 January 2010
Continue reading subprocess.popen and static define in Python

subprocess.popen and static define in Python

I like os’s subprocess.Popen() to run shell commands from within my Python code. I also like to define TRUE and FALSE to use as return values. Now I know what you’re thinking: there’s no such thing as ‘C’s #define in python because there’s no compiler to swap out of all your substitutions at compile time. However, it’s just as easy to achieve the same results.

Post thumbnail of Running bash shell scripts in debug mode to trace execution
26 August 2009
Continue reading Running bash shell scripts in debug mode to trace execution

Running bash shell scripts in debug mode to trace execution

This is so handy, I can’t believe i’ve never used or even heard of this until today! You can easily run your bash shell scripts in debug mode to watch what they’re doing behind the scenes in real time. You get to see the levels of nesting when you’re inside loops and variables get replaced with their actual contents at the time of execution.
This might come in handy if you have multiple levels of nesting in ‘for’ and ‘while’ loops or a few if/then/else statements and you want to see just what is getting passed in the comparisons.

Post thumbnail of Looping over a range in bash
7 April 2009
Continue reading Looping over a range in bash

Looping over a range in bash

I don’t know why I always forget how to do ranges, but I do. I guess it has something to do with the fact that I don’t expect it to be like C at all, and I don’t need to use it often enough to remember.

Share this:
  • Digg
  • Facebook
  • Reddit
  • LinkedIn
  • Google Bookmarks
Post thumbnail of Control VMware virtual machines from the command line
27 March 2009
Continue reading Control VMware virtual machines from the command line

Control VMware virtual machines from the command line

The vmrun command makes administering VMware virtual machines fast and easy when you’re stuck dealing with VMware Server 2.0. I really hate the web interface. It’s not responsive and in my opinion, a huge step backwards from the old 1.x consoles.

Share this:
  • Digg
  • Facebook
  • Reddit
  • LinkedIn
  • Google Bookmarks
Post thumbnail of See console messages in remote shells
14 March 2009
Continue reading See console messages in remote shells

See console messages in remote shells

In Ubuntu, Fedora and other systems I’ve seen rsyslog running on, to see the console messages you have to have physical access to the server usually through a KVM or IP-KVM setup. Kernel messages are sent to /dev/console while mail, crit, debug, and others get sent to files. Any of these message can be monitored remotely…

Share this:
  • Digg
  • Facebook
  • Reddit
  • LinkedIn
  • Google Bookmarks
Post thumbnail of How to start or stop a process that’s slow to respond
18 November 2008
Continue reading How to start or stop a process that’s slow to respond

How to start or stop a process that’s slow to respond

Got a process that you want to restart in a script but it doesn’t respond nicely?  Use the sleep command in your script and check its status after you start, stop, or kill it.  After incrementally backing off a few times, waiting longer and longer, I give up and exit …

Share this:
  • Digg
  • Facebook
  • Reddit
  • LinkedIn
  • Google Bookmarks
Powered by Wordpress   |   Lunated designed by ZenVerse