ColdFusion error message File Not Found

If you are staring at a error message produced by ColdFusion that reads “File Not Found” but you know the file is available from you Linux apache service, you would be having a similar day that I had last week. While searching around on the net, I found many many other posts that described this same problem, and their solutions where of no help. Most these articles talked about having the correct installation, disabling caching, or applied to an earlier version of ColdFusion, but I could not find any solution that applied to my situation:

I have many virtual hosts in Apache on a Linux server with two virtual hosts serving CFM files correctly from a ColFusion Multisite installation. But any new virtual hosts would produce the error “File not Found”.

This message is very deceiving, but I noticed that in the directory of:

/opt/jrun4/servers/cfusion/cfusion-ear/cfusion-war/

there is a CFM file, then the file is located. Bizarre! Anyways, the solution to this problem was really simple but I was thrown off by the error message. The solution is to make sure the ColdFusion user has executable rights on the directory being provided by Apache.

node.js how to pipe a output from child process into a webpage

This is a simple Node.js server that prints the output from a system command (in this example, its a tail program):

// how to pipe a output from child process into a webpage

// start with importing an http server
var http = require('http');
// import the spawn function
var spawn = require('child_process').spawn;

// create the server bound to port at bottom
http.createServer(function(request, response) {
	// write the header with 200 okay with content-type
	response.writeHead(200, {
		'Content-Type': 'text/plain'
	});

	// everytime there is a new request, spawn an child process
	var tail_child = spawn('tail', ['-f', '/var/log/system.log']);

	// kill tail_child everytime the connection ends to keep from many processes being created
	request.connection.on('end', function() {
		tail_child.kill();
	})

	// observe the output by binding to the data event
	//
	// because javascript is not good at handling buffers, use the function for buffering data
	tail_child.stdout.on('data', function(data) {
		// write it on the console
		console.log(data.toString());
		// send it to the browser because the browser will be waiting for the next chunk of data
		response.write(data);
	});

}).listen(4000);

Awk if statement for testing permissions of files and directories

By using stat and awk, you can gather some information for passing or failing a permissions check. Below is a bash script snippet I used for checking all the home directories in /etc/passwd to make sure they areĀ at permissions level of 755 or less. I am sure there is a better way of doing this and this might not work for people who have the sticky bit set, but for now it gets the job done:

stat -c "%a %n" `awk -F":" '{print $6}' /etc/passwd` | awk '{
if ($1 <= 755 )
  print "--- pass","=>",$0;
else
  print "+++ Fail","=>",$0;
}'