March 22, 2004
Make X work
While I don't run an X server on my server machine (just text mode stuff there), I will be getting a new machine in the near future, and, in the trickle down theory of machines, I think I'll have a slower (800mhz!) machine to play around with FreeBSD 5, and on that I will install X. I've done it a few times, on various Unixen, and it is a process fraught with peril. This is especially true if you are using some cutting edge video card. Trailing edge ones are your best bet. Anyway, here's an article that supplements the FreeBSD manual entry: The X Window System: ONLamp.com: Building an X Server and a Window Manager [Jun. 21, 2000] A little known fact - I was a developer on the original X Window system, way back in the days of MIT's Project Athena, where it all began. Actually, I wasn't an official developer, but I was one of the very first users of X Window System, as I worked as a teacher liason with Project Athena, and one of its centerpieces was X. I wrote a bridge game (unimaginatively called 'xbridge') that for years was on the X distribution tape. That was a looong time ago.....How To Ask Questions The Smart Way
Interesting article on how to intelligently ask questions in a public forum, like freebsd-questions. Fairly aggressive, but they are right, you know:-) How To Ask Questions The Smart WayMarch 18, 2004
Ports makefile
I've talked before about makefiles and ports (see here), but I just found out about Yet Another Makefile used by the port system: /usr/ports/Mk/bsd.port.mk. This one lists an amazing number of options that can and will be used by building stuff in the ports folders. It is of especial interest to port maintainers, but has some options that can also be useful for us mere mortals. One of the more interesting options are the BATCH and INTERACTIVE ones. They are only docuemented (in 4.9, anyway) indirectly, under the IS_INTERACTIVE comment in /usr/ports/Mk/bsd.port.mk, which I find more than a little odd for something so useful. If you set the BATCH environment variable (or, I assume, define it on the make command line thusly:$ make -dBATCH), it will not try to make any port that asks for interactive input. This is especially useful if you are doing a massive portupgrade and want to go away for a bit. Define BATCH in your environment (BATCH=1; export BATCH in bash) and it won't try to build interactive ones, like PHP, which has tripped me up a few times. INTERACTIVE is the opposite of BATCH. Define this, and only ports marked as INTERACTIVE will build. So you can do the BATCH portupgrade first, then come back and do the INTERACTIVE ones while you are there coaxing it along.
March 16, 2004
The 'wc' command
No, the 'wc' command doesn't "flush" anything :-). Someone asked on the freebsd-questions list "How do I count the number of files beginning with 'db' in my current directory?". And the key command is 'wc'. It's a nice, simple little command that does one thing and one thing well - it counts "words". If you don't give it any flags, it tells you the number of lines, words, and bytes. Using -l will count the number of lines. So you pipe the output of a command to it and it will count stuff for you. Thus:$ ls db* |wc -lwill give you a single number telling you the number of lines in its input; in this case, the input is the output of 'ls db*', which is a simple listing of all the files in the current directory beginning with 'db'. Thus, you get a count of the number of files in the directory that begin with db. A very typical Un*x way of doing things - string together building block commands to get your output. Flexbile if arcane. FreeBSD Hypertext Man Pages: wc
March 12, 2004
ch c/c++ interpreter
A cool looking utility that just may end up in the ports collection, as they are finishing up a FreeBSD version:Ch -- an embeddable C/C++ interpreter
portupgrade options
When using portupgrade, it can be nice to capture the output it generates, especially if it is a many port upgrade. There's a couple of solutions to this problem:- Use commands that grab the output and save it for you. tee and script are ones that immediately come to mind. Script is recommended in several books on FreeBSD, esp. when rebuilding the kernel, which can generate a lot of messages. I tend to do these things inside an emacs command shell, so I "automatically" get logging.
- portupgrade itself has a very handy option : -l filename. This will log the output to the file. The -L option gives you control over the name of the log file.
March 09, 2004
PHPAccess
Interesting looking PHP utility for controlling access to your web folders. It looks easier to use and more robust than .htaccess. PHPAccess: htAccess via PHP - The WWW Security Admin Tool with easy-to-use GUIDBDesigner
While not strictly a FreeBSD utility, this looks like an excellent "free" database designer, esp. for MySQL databases. It has a Linux KDE/Gnome version, which may just run under FreeBSD's excellent Linux emulation. Let me know if it does! fabFORCE.net's DBDesigner'id' command
I have often used the 'whoami' command to figure out who I am currently logged in as, if I somehow forget. However, if you need even more info than just who you are currently, you can use the id command. It gives you all sorts of info on your current login id, including groups and aliases. Nice. FreeBSD Hypertext Man Pages: idDisplay keyboard layout (in X)
I don't use X on my server, but I thought I'd point out this nice command that 'epi' posted to the -questions list for displaying a visual map of your keyboard:xkbprint -color -nkg 2 -lg 1 :0 - | gv -seascape -scale 4 -I still need to work on my keyboard map for my console though - I miss not having a meta key in emacs. But I've never gotten one that has all the "right" keys for me, so I stick with the default until I have the time to work on it.
March 05, 2004
cron mail
Whenever you run a command in your crontab, if there is any output, it will send you an email. This is sometimes a good thing, but sometimes not, depending on how often the job runs and what kind of output it generates. If you just want to get rid of "normal" output, and only have it email you if there is error output, you can redirect stdout to /dev/null, like thus:5 * * * * yourcommandhere >/dev/nullThis sends normal output to the bit bucket, but anything the command puts out the stderr (the error output) will get emailed you. If you want to ignore all output, error and normal, you can "tie" the error output to go to the same place the normal output goes, like thus:
5 * * * * yourcommandhere >/dev/null 2>&1Now you won't get any email. Another option for turning off email is to set the MAILTO variable to NULL. See the manpage for more discussion on this option.
March 04, 2004
Quickpatch
Excellent looking utility for keeping up with the Jones' ... err ... I mean the security updates and patches for FreeBSD. A perl script that will read the security bulletins and tell you (or even do) everything you need to know. I've always been a little lax at keeping up with these things, but I should be much more vigilant. Maybe this will help? Quick Patch for FreeBSD / Roq.comFix port collection
Okay, I'm doing it. Lots of other FreeBSD admins are doing it. Why aren't you?-) What is it we're doing? We're upgrading portupgrade, and ruby, that's what! We're doing this by carefully reading /usr/ports/UPGRADING and following its instructions.Sample ipfilter rules file
Sometimes, it helps to see an example. And when it comes to firewall rules files, that is doubly true. Here's Shaun Erickson's ipfilter rules file:IP Filter rules
trafshow
A utility that displays in some graphical way (on a text screen anyway) the current traffic on an interface card. I'm going to give this a try, as apachetop just crashes on me. Port description for net/trafshowRotate Apache logs
Yes, I've written a little about syslogd and the associated newsyslog previously, but here's a nice concrete example on how to use it. The gist of it all is that you just add the following line to your /etc/newsyslog.conf file:/var/log/httpd-access_log 644 7 100 24 B /var/run/httpd.pid 30Or at least one very much like it. Read more here:
The FreeBSD Diary -- Apache - rotating log files In fact, I'm going to head off and add this right now!



