how to redirect stdout for htpasswd in script
Posted on 2004-11-08
I've got an htpasswd authentication file that needs to be updated with the usernames and passwords from a database every day.
I've written a cron script that gets the values of the database and then calls htpasswd to update the authentication file. The output from the cron job gets emailed to me every day - usually, just a lot of "Updating password for user **username**" lines. I'd rather only get the cron email if there's a problem - a missing password or something.
My first thought was to just redirect stdout to /dev/null in the crontab, like this:
0 19 * * * /usr/bin/perl /home/user/bin/scripname.pl >/dev/null
but it doesn't seem to work. I still get the output from the htpasswd command emailed to me. Is it getting printed on stderr? if so, I don't want to redirect stderr to /dev/null because then I'll miss any errors that occur.
Am I doing anything wrong? Anyone had any experience like this?