exploring the ebb and flow of technology one whim at a time with Josh Barto n...
Wednesday, June 4, 2014
This is going to be a short post. I am working on altering a script so that postgres will store it's log in /var/postgres/931 instead of /var/postgres/931/data. When you set up SMF so that postgres may be started as a service, the log directory does not allow full paths. Clearly the only solution to this was to usea symbolic link. Ok... so if I plan on using this script for future version of postgres how do I get the data dir path for postgres. That solution was fun to work on as it taught me more than I really wanted to know about sed (stream editor). The command is as follows:
root@mymachine:~# ps auxw | grep postgres | sed -r 's/.* (-D) (.*) ?(-i)/\2/' | head -n1
/var/postgres/84/data
There isn't much to this, just a regex that gets everything in between -D and -i after output from ps has been piped in showing the paths that postgres was started with.
After a day and a half of attempting to install awstats, a free log analysis tool in aolserver I came across a forum post that seemed promising, however the link mentioned by the poster was dead. Awstats must be installed in the cgi-bin, a somewhat antiquated installation method that truthfully I must admit I have never before attempted. However, a short skip and a jump through archive.org later and I had a cached version of the quoted weblink. This website while not altogether different from others I had found on google, gave me the push I needed to reorganize the code in my nsd.tcl file corresponding to cgi-bin setup. Here is the solution I found to enabling cgi-bin scripts usage in aolserver.
Some
assumptions, if you are hoping to get the same results I did
You
are running at least version 4.5.1 of Aolserver