Life in Shell
Specifically bash, the Bourne-Again Shell. I shackled myself to the computers today: I dropped the kid off at 8:30, stopped at Starbuck's to pick up the grande soy latte and was back at home and booting up before 9am. I stopped about an hour ago to go get some excercise. I have to say I had an exhillerating day. So today's post is a mental note; some things I needed while working and I'd like not to forget. I won't say I learned a lot of new things, but the details can cost a few minutes here and there. Up front, the environment was my Linux FC 4 install (the Beausoleil workspace on Ruby, for those that are keeping up). I also kept the stallwart notebook (Lime) beside me for some draft work and Windows testing. What else could a ten pound laptop be but stallwart? I'm getting punchy, it must be late. On with it then... Dos2Unix This is a command that just replaces all the \r\n line-terminators in your text file with \n. One of the Perl scripts that came with awstats 6.5 must've been saved in a Windows editor. The symptom when I tried to run the file (or another piece of awstats tried to run it) was an error message saying : bad interpreter : No such file or directory A little searching turned up this message on a list. The suggestion of sed 1q rc.firewall | od -c passes the first line (1q for line 1) of the script in question to the od -c. The od command does octal display. Who knew that'd be any use. It makes the line terminator clear though. So to a user the first line of the script looks correct: #/usr/bin/perl but the line ending messes up bash. The dos2unix command will fix it, but remember to chmod the script afterward to make it executable again.
KNetAttach and the fish protocol I found knetattach by chance when poking around in KDE. At the time I thought I was pretty cool because I had set up host keys for various servers I deal with. Beyond that I had added Host sections to my ~/.ssh/config file for each of the hosts and included User settings so that I could ssh or scp with a pretty simple command. Having something pretty secure and readily available prevents me from taking shortcuts like simple passwords or unsecured ftp connections. Anyhow, when I tried KNetAttach I saw it allows you to create a "network folder." It works over WebDAV, FTP, Samba or ssh. I set up one of my connections back then over ssh with my handy new host key. I made a shortcut for it in Konqueror and now I can easily browse the server, open up files to edit them and see changes instantly when I save. So the problem I had was that setting up one server I needed to specify a port number I couldn't enter in the GUI. There's not a lot of help on KNetAttach and I didn't pay much attention to the address it used (in the address bar, that is). Today I finally dug in a little and quickly found out that I've been using the fish protocol. So all I had to do was type in the address manually in Konqueror. It handled the rest. I found an article on it at Linux.org but it really doesn't say much more than I already have. I also found something on FUSE and sshfs at Linux.com that tempted me to try out sshfs. I think fish might only work with KDE applications, so something that gets lower level might be important eventually. The address for a folder connected via fish looks like: fish://username@remote.host/path/to/stuff/ I had to do some digging to find the author's homepage, but apparently Pavel Machek did something really helpful for me, so the least I can do is give him some credit and say thanks. 1and1 custom Logfile format Jason figured out how to make FunnelWeb work with the custom Apache logs that 1and1.com uses. Funnel Web is a great free (as in beer) stats analyzer, but I can't run it in Linux, so I've been using Awstats. Awstats is a great free (as in speech) web stats analyzer. I found very detailed step-by-step instructions on setting it up over here. The only part I needed to know was how to turn this: CustomLog /var/log/httpd/access_log "%{Host}i %h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\" %b" into this: LogFile="/yada/yada/yada/awstats-6.5/tools/logresolvemerge.pl /yada/yada/yada/access.log.* |". The first line comes from the httpd.conf that 1and1.com uses and the second is the one that awstats needs. There's more detail on the CustomLog directive in Apache's documentation, of course. I think logresolvemerge.pl was the file I mentioned earlier that comes in DOS format with awstats.
2
Your rating: None Average: 2 (2 votes)