How to slove slowly stuff about network daemon

Why this page?

On ArchLinux, sometimes network daemon and synchronizing time via the internet got slow (However the time is synchronized properly.).It made me annoyed, and I decided to solve it.

Warning

This document is for ArchLinux only, If your Linux is not ArchLinux and use this way, you may get troubles.

The way to solve

  • Writing daemon to run network, ntpdate, and ntpd in order, then run the daemon asynchronously.

Implementation code

  1. #!/bin/bash
  2. . /etc/rc.conf
  3. . /etc/rc.d/functions
  4. case "$1" in
  5. start)
  6. stat_busy "Setting up network stuff"
  7. stat_done;
  8. /etc/rc.d/network start
  9. /etc/rc.d/ntpdate start
  10. /etc/rc.d/ntpd start
  11. ;;
  12. stop)
  13. stat_busy "Shutting down network stuff"
  14. stat_done;
  15. /etc/rc.d/network stop
  16. /etc/rc.d/ntpdate stop
  17. /etc/rc.d/ntpd stop
  18. ;;
  19. restart)
  20. $0 stop
  21. sleep 1
  22. $0 start
  23. ;;
  24. *)
  25. echo "usage: $0 {start|stop|restart}"
  26. esac

This file is called "networktime" in this document.

Adding to rc.conf

Delete daemon: network ntpdate, and ntpd
Add daemon: networktime