Wrong charset for cron

I got a issue on a export job i had that was running daily on which the charset of the data exported wer wrong, and this did not happen when i ran the job manually. I noticed that Cron used the charset “POSIX” instead of en_US.UTF-8 which i used. I fixed this by adding “LANG=en_US.UTF-8” to the file /etc/default/locale.

It appears that when the LANG variable is not set in that file, Cron will fall back to using the POSIX charset.

Munin-graph error: Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()

You may get a mail from cron complaining about “Pango-WARNING **: Invalid UTF-8 string passed to pango_layout_set_text()”, if you are running Munin. This is caused by Munin not receiving valid UTF-8 data.

For this you have 2 possible solutions:

1) Patch munin-graph manually using:
http://munin-monitoring.org/svn/munin/branches/debian/lenny/trunk/debian/patches/380-munin-graph-utf8.patch

Note that the line numbers are a bit off if you are using another version.

2) Find the munin-node plugin that causes the problem(aka having some none utf-8 characters). Most likely it is the following line in the plugin hddtemp_smartctl:

print “graph_vlabel temp in °Cn”;

Change it to:

print “graph_vlabel temp in Cn”;

Restart the munin-node and you should not get more trouble, at least from that plugin.

Cron commands not working when outputting to stderr(2>&1)

The error:

username@host:/home/foo> fetchmail -f /opt/rt-fetchmail/fetchmail 2>&1 /dev/null
Enter password for username@/dev/null:

Solution: Change the cron entry / command to the following:

fetchmail -f /opt/rt-fetchmail/fetchmail > /dev/null 2>&1

This will stop -all- output from appearing.