phpList: processing with cron & bash script: “Command not found.”

If you are trying to process your phpList queue using a crontab, you will have to set up the phplist script provided in the bin directory to work with your system. It looks like this:
#!/bin/bash# script to run PHPlist from commandline. You may need to edit this to make it work
# with your shell environment. The following should work for Bash# in commandline mode, access is restricted to users who are listed in the config file
# check README.commandline for more info# identify the config file for your installation
CONFIG=/home/website/public_html/lists/config/config.php
export CONFIG# alternatively you can use -c on the commandline# run the PHPlist index file with all parameters passed to this script
/usr/bin/php /home/website/public_html/lists/admin/index.php $*

Of course you will want to modify all the paths to fit your phpList install. Most importantly, however, is to not forget to modify the FIRST line if need be. Otherwise, if your bash interpreter exists elsewhere, when your try to execute your script you will get the following error:
/path/to/phplist: Command not found.
For the majority of the installations out there, /bin/bash should be fine, however on some systems you may need to edit this to point to where your bash interpreter is installed. In my case, I had to change it to /usr/local/bin/bash.

To future-proof my changes, I also symlinked to where my bash existed:
ln -s /usr/local/bin/bash /bin/bash
That way I will not have to re-edit new versions of the phplist script in future phpList upgrades.

Windows & NTFS: Cannot rename file, or: Working with files containing double periods (..) in filename.

I had downloaded a folder from a friend’s FTP server titled “Orchestrated & Conducted by..” the other day. When attempting to browse inside the folder using Windows Explorer I was given the following error:
D:\Orchestrated & Conducted by.. refers to a location that is unavailable. It could be on a hard drive on this computer, or on a network. Check to make sure that the disk is properly inserted, or that you are connected to the Internet or your network, and then try again. If it still cannot be located, the information might have been moved to a different location.
Great. Unable to access a folder on my hard drive! I’m assuming it’s because of the “..” characters in the directory name. It is of course in Windows’ best interest for security reasons to not deal with any mischievous files trying to read the directory above it.

So I tried a few other things to access the folder. First I tried renaming the folder. Windows explorer lets me Right Click > Rename and even lets me type in a new name. However, when I press Enter to rename the file, I get the following:
Cannot rename file: Cannot read from the source file or disk.
Great. So I brush off my dusty old DOS skills and open up a command shell, navigate to the dir containing the bastard, and try it old school style:
D:\> rmdir "Orchestrated & Conducted By.."
The system cannot find the file specified.

Great. Now lets get medieval on this folder’s ass!
D:\> dir /x
Volume in drive D is Data
Volume Serial Number is BC1A-DBC4
Directory of D:\
 
01/03/2006 04:35 PM <dir> ORCHAS~1 Orchastrated & Conducted By..
0 File(s) 0 bytes
1 Dir(s) 35,736,907,776 bytes free
 
D:\> rmdir ORCHAS~1
D:\>

SUCCESS!

So, if you ever have an unruly folder, the way to deal with it is to use 8.3 notation when handling your files. To see what a file or folder’s 8.3 notation is, simply type dir /x at the command prompt.

The funny thing is that I used to have 8.3 notation disabled for performance reasons but had recently re-enabled it because of a software incompatibility with Mozilla Firefox. I have no idea how I would have gotten rid of this loco folder if I hadn’t of re-enabled 8.3 notation.

Logitech diNovo Wireless Desktop Review

Logitech diNovo Wireless DesktopThe population explosion of gadgets and their connectors on my desktop had finally pushed me to make the jump to a wireless desktop. I was looking for a few things: simple keyboard/mouse combo, minimal bells & whistles, nice look & feel, and something that just works. Since I don’t need an espresso machine or back-massager built into my wireless desktop, I was pleased to find the sexy Logitech diNovo Media Desktop: Sleek, stylish, simple, and of course, wireless… without all the fluff!

I did my research and read plenty of positive and negative reviews, but most of them seemed to revolve around problems with Logitech’s software and driver package for the diNovo’s media center controller capabilities. I wasn’t looking for any of that, so I decided to gamble and invest in the admittedly expensive ($158.89 from NewEgg.com) diNovo.

Below you will find my completely non-official, non-technical, stream-of-consciousness review of the diNovo.

I was up and running in no time. Simply plug in the USB-Bluetooth dongle, power up, and everything was instantly recognized and installed by Windows XP. A quick 4-hour charge of the mouse on the handy cradle and everything was good to go. Keep in mind, I simply did not care for any of the extra bells, whistles, buttons, and features that the diNovo offered, I was only interested in the keyboard and mouse operation. So if you want all that extra crap, you will have to install all the Logitech software and drivers which, apparently, cause people all sorts of problems. Just know that the keyboard and mouse themselves work great as plug-and-play devices in XP, and don’t require ANY third party software installation to operate right out of the box.

The mouse is a bit heavier than my old Microsoft optical, which concerned me at first, but now I don’t even notice it. The extra weight even actually helps a bit with super-fine mouse navigations, as it gives more physical feedback to your hands than a flimsy lighter mouse. The buttons click and the wheels scroll, which is all I needed, so this laser mouse gets an A grade from me.

I have had absolutely ZERO major problems. Granted, I never installed any of the Logitech drivers, as I only need a simple keyboard and mouse combo. If you want all the bells and whistles, I imagine you’d run into some potential problems, but if you want just a simple keyboard and mouse like myself, this is a great investment. In the month I’ve been heavily using the diNovo, I’ve only had one issue with Bluetooth where my keyboard lost connectivity. I had to pop out the batteries and re-insert them for my keyboard to become responsive. Sometimes when returning to my desktop after being idle, it takes a split second for they keyboard and mouse to kick on and become responsive, but it’s hardly even noticeable. Once the Bluetooth reconnects, everything is back to normal. It’s a worthy trade-off in my opinion: trade a little instant gratification for extended battery life.

I do have a few minor gripes, but they can probably be attributed more to my personal idiosyncrasies than anything else. I don’t like the fact that the keypad is separated from the keyboard. I’m assuming they did this so that you can use it as a remote-control for your media center, but I’m not using any of that junk. It is quite annoying that when I move my keyboard around the keypad doesn’t come with it. This also leads to another gripe. I like my keyboard slanted towards me, so I open up the little legs on the bottom to elevate the top a bit. Of course the separate keypad doesn’t have any legs, so it sits flat while my keyboard sits slanted. It’s fairly annoying that a product that supposedly spent so much effort in the style arena didn’t think this through, because now my otherwise elegant media desktop looks like a stupid non-matching set of pieces. This could have easily been solved by either giving the keypad its own legs, or making it possible to attach it to the main keyboard. Ahhhh well, nothing’s perfect I guess.

PROS:

  • Wireless!! Duh.
  • Mouse is re-chargeable and has never let me down even after extended (10+ hour) usage. Simply pop the mouse on its charging cradle before you go to bed and you’ll always have a full charge at your disposal the next day.
  • Mouse has an LED indicating battery charge. There are 3 bars and I’ve never seen it go below two bars, even after a full day’s use.
  • Laser mouse is more accurate that old-style opticals.
  • Mouse “heft” makes it feel like an actual tool rather than a cheapo piece of plastic. The extra weight helps with pointer-detail stuff.
  • Look and feel is top notch. No bulbous buttons or monstrous extrusions where they need not be. Minimalist stylings look great!
  • Laptop-style keys: Although it is a full-sized keyboard layout, the keys themselves are the thinner and softer laptop style. Quieter and easier to type on. More my style.
  • Built in calculator in the keypad is a plus. I’ve found myself using it more than XP’s calculator.

CONS:

  • Keypad is separate from keyboard (personal preference). They should have at least made it attachable so that you have an option.
  • Keypad doesn’t have its own feet to slant it towards you a bit. So if you slant your keyboard you end up with an un-even layout.
  • Keypad screen is not backlit. It’s difficult to see unless you’re in bright light or you’re 2 inches from the screen. Of course a backlit screen would suck the battery to death, so I don’t mind too much.
  • Slight half-second delay when waking from idle battery-saving mode. Not a big deal.

Now my only hope is that this baby lasts long enough for it to be worth what I paid. The last Logitech keyboard I bought crapped out after about 3-months. Lets hope that the diNovo can redeem the Logitech name in the eyes of this beholder.

Snoopgate: Freedom vs. Security

What do I think about recent revelations that president Bush authorized a secret domestic spying program?

I think Benjamin Franklin said it best:

Those who would give up essential liberty to purchase a little temporary safety, deserve neither liberty nor safety.

Conservative apologist talking points seem to revolve around the idea that this sort of erosion of civil liberties is somehow an essential trade off in protecting ourselves from a terrorist attack. I ask them this: Who needs the terrorists to disrupt our way of life and destroy the founding principles of this nation when our own government seems perfectly willing and able to do it for them? With friends like these, who needs enemies?

The terrorists have taken some lives and some expensive real estate. It’s starting to look like my government has taken a lot more.

phpList/Sendmail/Linux: X-Authentication-Warning

As a follow-up to my post on getting rid of the X-Authentication-Warning error when using phpList on FreeBSD, here’s how to do the same in Linux.

Open up /etc/mail/trusted-users in your favorite editor, and add both the user that your Apache is running under, as well as any usernames which are processing phpList queues and bounces via crontab. For example, your trusted-users file should look like this:
httpd
yourusername

Save & Exit. Restart sendmail with the following command:
/etc/init.d/sendmail restart
Now when you send mail with phpList, the headers won’t contain X-Authentication-Warnings.

One security drawback that you should be aware of: Any user on your system can now use PHP to send email with “forged” headers. You basically just gave everyone on your system “Trusted User” status to Sendmail, so be sure that you trust your users before actually doing this!

See how to do this on FreeBSD

phpList with crontab: USER environment variable is not defined

When trying to automate processing of the mail queue and/or bounces in phpList, I came across the following error when calling the phplist command line script from a crontab:
Error: USER environment variable is not defined, cannot do access check. Please make sure USER is defined.
This happens because when a crontab executes, the $USER variable is not set. We must set it in our script. So open up the phplist file and add the following:
USER=youusername
export USER

The entire file should now look like this:
CONFIG=/path/to/phplist/config/config.php
export CONFIGUSER=yourusername
export USER/path/to/php /home/yourusername/path/to/phplist/admin/index.php $*

Note that you also must set the $commandline_users variable in your config/config.php:
$commandline_users = array("yourusername");
With all of that in place, you can automate your queue and bounce processing with a crontab like this (adjust your paths accordingly):
# Suppress crontab emails
MAILTO=""
# Process phplist queue daily, every half hour
0,30 * * * * /home/yourusername/phplist -pprocessqueue
# Process phplist bounces once a day, 5am
0 5 * * * /home/yourusername/phplist -pprocessbounces

Apache with SSL: “dftables: error while loading shared libraries”

While updating OpenSSL & Apache on a Linux machine (2.4.7-10smp), I came across an error when running ‘make‘ for Apache:
/usr/local/src/httpd-2.0.55/srclib/apr/libtool --silent --mode=link gcc -g -O2 -pthread -DLINUX=2 -D_REENTRANT -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DAP_HAVE_DESIGNATED_INITIALIZER -I/usr/local/src/httpd-2.0.55/srclib/apr/include -I/usr/local/src/httpd-2.0.55/srclib/apr-util/include -I. -I/usr/local/src/httpd-2.0.55/os/unix -I/usr/local/src/httpd-2.0.55/server/mpm/prefork -I/usr/local/src/httpd-2.0.55/modules/http -I/usr/local/src/httpd-2.0.55/modules/filters -I/usr/local/src/httpd-2.0.55/modules/proxy -I/usr/local/src/httpd-2.0.55/include -I/usr/local/src/httpd-2.0.55/modules/generators -I/usr/local/ssl/include/openssl -I/usr/local/ssl/include -I/usr/local/src/httpd-2.0.55/modules/dav/main -export-dynamic -L/usr/local/ssl/lib -o dftables -L/usr/local/ssl/lib dftables.lo -lssl -lcrypto
./dftables > /usr/local/src/httpd-2.0.55/srclib/pcre/chartables.c
./dftables: error while loading shared libraries: libssl.so.0.9.8: cannot open shared object file: No such file or directory
make[3]: *** [/usr/local/src/httpd-2.0.55/srclib/pcre/chartables.c] Error 127
make[3]: Leaving directory `/usr/local/src/httpd-2.0.55/srclib/pcre'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/src/httpd-2.0.55/srclib/pcre'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/httpd-2.0.55/srclib'
make: *** [all-recursive] Error 1

I figured this was because of an inconsistency between the two versions of OpenSSL I had on my system. The system came with the SSL libraries installed in /usr/lib, which I had updated as symlinks to my newly & manually installed directory /usr/local/ssl/lib. That wasn’t enough. Apache (dftables specifically) needs to know where the new libraries are, so we must tell it where to look. Do this by adding our new lib dir to /etc/ld.so.conf. Open it up in your favorite editor and add the following line:
/usr/local/ssl/lib
Save & Exit, then run:
/sbin/ldconfig
Now re-run make in your Apache dir and everything should go smoothly. Note that you may want to run make distclean first just to be sure you start with a clean slate.