A couple of days ago I was needing to solve an issue with our EAI framework. The implementation of such framework could be basically described as instances of Java programs running under Solaris, but there’s a particular instance that should be running just once. So I wrote this tiny shell script to avoid launching that program twice:
#!/bin/ksh
#
theProcess=someProcess
if [ $(pgrep -u $USER -f $theProcess | wc -l) -gt 0 ] then
echo "There is an instance of "$theProcess" already running."
else runTheProcess
fi
someProcess could be any regex that matches the process description,
runTheProcess is whatever command that executes the process.
Okay, that’s all, I hope you’ve found it informative and thanks for reading!
Archive Page 2
Checking For Duplicated Processes In Korn Shell
Published February 20, 2008 KSH , Korn , Scripting , Shell , Solaris , UNIX , pgrep , wc 2 CommentsHello world! Well basically I’m shifting the course of my beloved little blog from just quoting slash reposting or, in a more trendy web 2.0ish lingo, “consuming syndicated content”, to actually authoring my own stuff, that is, in principle, publishing any tip, trick, hack and what have you I happen to consider my audience would be interested in reading (that audience being just my close friends at the moment). Anyway, so without further ado, let’s make it happen! And as a footnote, please be nice with what I like to call “my developing creative writing talent”, I’m no language major, actually I’m not even a native English speaker, but I will do my best to write it all pretty for you guys
Getting Started with Grails
Published February 7, 2008 Books , Development , Folksonomy , Free , Grails , Groovy , Hibernate , JVM , Java , Open Source , Programming , Scripting , Spring , Web Development Leave a CommentGrails is an open-source, rapid web application development framework that provides a super-productive full-stack programming model based on the Groovy scripting language and built on top of Spring, Hibernate, and other standard Java frameworks.
Jason Rudolph is an Application Architect at Railinc, where he develops software that helps keep trains moving efficiently throughout North America.
The book can be downloaded for free (registration required), but also you could always purchase the printed copy.










