After installing vnstat, /etc/cron.d/vnstat is created, but per default it won't be executed by vixie-cron and fcron. Reproducible: Always Steps to Reproduce: 1. 2. 3.
Afaik fcron doesn't support /etc/cron.d. As for vixie-cron, I don't see any reason why that vnstat script wouldn't work, assuming you have activated at least one interface with 'vnstat -u -i interface'.
vixie-cron simply doesn't execute the scripts in /etc/cron.d/ on my machine, i dunno why ;) there's no entry in /etc/crontab to make this work.
Ok, located the problem, that vnstat cron entry that the ebuild installs (/usr/portage/net-analyzer/vnstat/files/vnstat) is broken. The original that comes with the source package (cron/vnstat) having just one line 0-55/5 * * * * root if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ]; then /usr/bin/vnstat -u; fi is what that /etc/cron.d/vnstat should look like.
You realize that the one-line is the same at the cron.d...
That's not the same. I just checked that the ebuild still installs ${FILESDIR}/vnstat.cron to /etc/cron.d and that vnstat.cron contains: -snip- #!/bin/bash # run vnstat if installed and at least one database exists if [ -x /usr/bin/vnstat ] && [ `ls /var/lib/vnstat/ | wc -l` -ge 1 ] ; then exec /usr/bin/vnstat -u fi -snip- and that's something that wont work with cron. It should only contain that one line I showed in comment #3.
There are two reasons why the cron script would not work: 1. /etc/cron.d is only supported by vixie-cron. 2. /etc/cron.d is for system crontab entries (same format as /etc/crontab), not bash scripts. I've fixed it to install into /etc/cron.hourly.