Welcome to my blog! Feel free to post comments.
- Andrew


Visit Coldfusion Community


<< October, 2005 >>
SMTWTFS
1
2345678
9101112131415
16171819202122
23242526272829
3031
Search Blog

Categories
Archives
RSS


Powered by
BlogCFM v1.14

Rude bloggers, Rude techies, Poor documentation
A Reason Why
19 October 2005

Ok, im not a newbie.  Perhaps compared to some, i might be, but with a good 12 yrs of this biz under my belt, i don't consider myself to be one.

So here is my rant on why newbies (n00b) shouldn't get upset when techies are rude and abrupt.  BTW, im not talking about this Blog, since its relatively new -- don't flame me because my blog isn't gigantic like other peoples.  My literary works are spread amongst a vast diverse medium.  This is my blog, not yours, so what goes on here is up to me and nobody else.

I used to be a newbie.  I got super pissed whenever I would be researching some java API or unix app that i had to compile.  Of course i had problems, and of course, I didn't know how to use freaking vi (I hate vi, but thats a different story).  Trying to ask for help online for something like cron, ssh, apache + ssl, qmail (yeesh!!), xinetd or some of these other "behind the scenes" programs that have been around forever is painful.  The only people who make themselves available are the experts, and they really only want to answer questions that interest them.

I can attest that over the years, as unique questions come up, I am interested.  Its the repetetive annoying questions about the same old crap that annoys me.  The first 500 times somebody asks me how to change their password was tolerable, now i want to put a gun in my mouth.  Some of us (the good ones, sorry to the rest) actually document stuff and make their lives easier.  The rest are just wanting self-abuse, because without documenting your crap, nobody will ever learn.  Its as much for you as it is for them.

So, whenever anybody (newbie or otherwise) asks us a question, its no wonder we say "did you RTFM ?" (RTFM = Read the F*&(*^% Manual for you newbies).  If you haven't read the manual and at least made an attempt to better yourselves before asking, we will have no interest.  Its in part because we are busy, but also in part because somebody painstakingly took the time to document it, so not looking at the documentation is a hyper-slap in the face.  Might as well kick us in the groin while you asking, at least you would get our full attention (if you actually do that, better expect retaliation). 

Soooo, please RTFM before you ask us a silly amateur question.  We simply want to see that you have put in your time and if you are truly worthy of our time.  I know, its [crazy] rude, but you know, you need to develop good habits, so look at us as a [sic] type of teacher.  You will be better off rolling up your sleeves and figuring out some things on your own.

Ok, that said, now its time to flame the teachers.  Some of us have taken things to extremes...  A good example is the amazingly vague documentation of Dan Bernstein (of qmail fame).  Granted, I love qmail and use it religiously now, but my gosh, it was so freaking painful to learn it from the beginning.  There are a few good books, but as a financially strained student, who can barely afford a $0.10 pack of ramen noodles for lunch, no such thing as budget for books like that.

The world would be much better for everybody if people would document things better.  If we are going to require people to read manuals before bothering us with silly questions, then we better put in good time to make our documentation worthy of research.

Thats about it.  Don't be offended by this rant, it was as much for me as it is for you.

Posted by aschwabe at 12:00 AM | Link | 0 comments


ColdFusion MX and JRun 4
Letting users restart their own JVM's

Ok, is anybody else frustrated that between JRun 3 and JRun4, the ability to let users log into the JMC and see only their own JVMs was lost ?  Back in the good ole' days, you could assign a JCM to a JMC user and all was happy...

Anyway, i sought an answer to this for quite a while and never found a solution out there and Macromedia seems to be skirting the issue, so i said screw it, and came up with my own solution.  Note: This solution is for LINUX, not windows.  Sorry windows folks, you will have to try to adapt this solution.  Hope it works out.

Requirements:

  • Some experience with ColdFusion and JRun (4 preferably)
  • ColdFusion (any version, including CFMX running on JRun4)
  • JRun 4 - remember this is a tool for letting people restart JVMs on JRun
  • sudo installed on your Linux server (if you don't know what sudo is, leave right now -- im serious)

For the smart people using Linux, here is the general concept:

  1. Provide some place for your users to log in (this is your responsibility).  This is where you will provide the links for these users to restart their JVMs.
  2. Provide them with ColdFusion (cfml) pages that do a <cfexecute> to stop/start the specified JVMs
  3. Configure sudo on your server to allow the coldfusion user to run Jrun commands as root
  4. When a user chooses to stop/restart a server, sudo makes sure it is run with the proper permissions

NOTE:  This is not an exercise in security.  Use this technique as you want, but this comes with no warranty expressed or implied.  If you get burned, I don't want to know about it.  Use with care, as this is what worked on OUR servers, not YOURS.

Step 1: Configure sudo on your Linux Server

Ok, this step will allow the request to "restart" a JVM to run from somebody's web browser.  First, find out what user the ColdFusion server is running as.  If you have access to telnet or ssh for the server (you better, if you are doing this), then do a ps -ef and you should be able to easily figure out what user the ColdFusion server is running as:

nobody    3853  2484  0 15:17 ?        00:00:00 /opt/coldfusionmx/bin/cfusion -start default
^^^^^^^^

In this case, it is the user "nobody."

Ok, now edit the /etc/sudoers file and allow user "nobody" to execute the jrun admin program:

Cmnd_Alias      JRUN=/opt/jrun4/bin/jrun
nobody  ALL = NOPASSWD: JRUN

Note: This is not a lesson in how to use sudo or configure the sudoers file.  If you want that, go here.

Ok, now the user "nobody" can run the command /opt/jrun4/bin/jrun as root without being asked for a pssword. yum.

Obviously if your jrun4 is installed somewhere else, don't be silly, change the path to where yours is installed.

Step 2: Write some nifty CFML Code

Here are several code segments.  Use them as you see fit.  This isn't a complete application -- it will require you to figure out how to assemble them to meet your needs.  The variable #servername# is the name of the JVM you want to start/stop/etc.

Check to see if a JVM is running or not:

<cfset servername = "jvm_server">
<cfexecute 
    name="/usr/bin/sudo"
    arguments="-u root /opt/jrun4/bin/jrun -status #servername#"
    variable="status_info"
    timeout="20">
</cfexecute>

Stop the JVM:

<cfset servername = "jvm_server">
<cfexecute 
    name="/usr/bin/sudo"
    arguments="-u root /opt/jrun4/bin/jrun -stop #servername#"
    variable="status_info"
    timeout="20">
</cfexecute>

Start the JVM:

<cfset servername = "jvm_server">
<cfexecute 
    name="/usr/bin/sudo"
    arguments="-u root /opt/jrun4/bin/jrun -nohup -start #servername#">
</cfexecute>

Notice: When starting a JVM, we use the "-nohup" argument - this makes it not keep open a shell connection.  It also means we can't get back useful info about the JVM starting up.  The others have something useful returned in the "status_info" variable.

Well thats about it.  Have fun.  I have to run off and fix somebody else's universe now.

ciao

Posted by aschwabe at 12:00 AM | Link | 1 comment