Previously on this forum, I posted a thread titled Performance Statistics Graphs not Working, which was about a problem I was having with the statistics graphs not working properly on my Raspberry Pi after a reboot. I was told that I could either work around the problem, or purchase a RTC for my Pi.
I've decided to opt to work around the problem by modifying the "/etc/rc.local" file to perform an NTP server sync multiple times to be certain that it is accurate. After the sync is executed, I execute "service collectd start" and "service rrdcached start".
I've tried to prevent collectd and rrdcached from starting before this by executing "update-rc.d collectd disable" and "update-rc.d rrdcached disable", but both commands generate a warning "using dependency based boot sequencing", and when I try to reboot, the problem with the graphs still occurs, which suggests to me that the daemons were not disabled.
I've also tried "insserv -rv collectd" and "insserv -rv rrdcached", and although I received no error messages, the problem appears to have not been resolved.
How can I disable them?
Here is my modified "/etc/rc.local" file:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
fi
test -f /etc/ssh/ssh_host_dsa_key || dpkg-reconfigure openssh-server
# Before attempting to sync with NTP server, make sure we are connected
# to the internet.
STATE="error";
while [ $STATE == "error" ]; do
#do a ping and check that its not a default message or change to grep for something else
STATE=$(ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` > /dev/null && echo ok || echo error)
#sleep for 2 seconds and try again
sleep 2
done
# NTP Server Sync - to make sure the time is in sync, we will do this five times since it doesn't
# always work on the first try.
ntpdate -u pool.ntp.org
ntpdate -u pool.ntp.org
ntpdate -u pool.ntp.org
ntpdate -u pool.ntp.org
ntpdate -u pool.ntp.org
service ntp start
# After the NTP server sync completes, start the RRDTool services.
service collectd start
service rrdcached start
exit 0
Alles anzeigen