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.
Best Answer
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