Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 60711 - vnstat creates /etc/cron.d/vnstat but per default it won't be executed
Summary: vnstat creates /etc/cron.d/vnstat but per default it won't be executed
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-17 13:31 UTC by theclaw
Modified: 2005-01-21 11:05 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description theclaw 2004-08-17 13:31:58 UTC
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.
Comment 1 Teemu Toivola 2004-08-29 10:30:00 UTC
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'.
Comment 2 theclaw 2004-08-29 11:15:35 UTC
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.
Comment 3 Teemu Toivola 2004-09-12 06:30:18 UTC
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.
Comment 4 Eldad Zack (RETIRED) gentoo-dev 2004-10-27 01:12:58 UTC
You realize that the one-line is the same at the cron.d...
Comment 5 Teemu Toivola 2004-10-27 01:38:34 UTC
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.
Comment 6 Aaron Walker (RETIRED) gentoo-dev 2005-01-21 11:05:17 UTC
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.