I installed vnstats to see bandwidth statistics, I copied an init.d file tempalte, I placed it in init.d directory, it works ok to access this file and do start/restart/status, but this file should start automatically on system boot, correct? It doesn't start, how can I debug this? If after system boot I do init.d/vnstat then it starts.
I am running Centos 5
Thank you.
If you write an init script with the correct syntax, you can turn it into a service:
chkconfig --add vnstats
after that, you can turn it on or off for certain runlevels:
chkconfig --level 345 vnstats on
You can also manually start or stop services with the service command, using the functions declared in the script itself. For example, if your script has a function called stop and one called start, you can use
service vnstats stop
andservice vnstats start
Suggested reading: the official documentation
If the init.d has a chkconfig setting, they you can
chkconfig --add vnstat; chkconfig vnstat on
You should really follow earlier suggestions of adding a chkconfig section to your initfile, but if you're lazy and want to work around this, you can just symlink the file yourself like this:
If you want to pursue the chkconfig path and lack the chkconfig package, install it with:
yum install chkconfig