Thursday, November 26, 2009

Suppress rm No such file or directory

rm: cannot remove `*.html': No such file or directory


If you have a cron job that deletes files daily or on another schedule you probably don't want to get the email that tells you something like that. There's always the option of redirecting the output to /dev/null but then you're screwed if there's any other errors that you actually want to know about.

Instead, use the -f or --force flag of the rm program. That flag literally means ignore nonexistent files, never prompt. So instead of getting that cannot remove error, it will just go about business as usual.

Instead of the following to delete two types of files,
rm /path/to/*.html; rm /path/to/*.html.gz


Use the following to delete them and not have to worry if one type doesn't exist.
rm -f /path/to/*.html; rm -f /path/to/*.html.gz

Monday, November 2, 2009

svnserve.conf: Option expected

If you get this error when trying to checkout an SVN repository you likely have whitespace before one of the settings in the svnserve.conf file the path in the error refers to. There should be a number in the error, which will tell you what line the whitespace is on.

For instance, the following error is given if I remove the hash from the beginning of the passwd line and leave the whitespace there between the beginning of the line and the start of the option.

svnserve.conf:20: Option expected