Browse Source

Initially start tlsdate with the timewarp option

Bob Mottram 11 years ago
parent
commit
2de1fba73a
1 changed files with 59 additions and 0 deletions
  1. 59
    0
      beaglebone.txt

+ 59
- 0
beaglebone.txt View File

1010
 
1010
 
1011
 This obtains the date and time from www.ptb.de every 15 minutes. Obviously if you wish to use a different source for the date and time then the cron entry can be edited accordingly.
1011
 This obtains the date and time from www.ptb.de every 15 minutes. Obviously if you wish to use a different source for the date and time then the cron entry can be edited accordingly.
1012
 
1012
 
1013
+To ensure that the system always gets the correct time on initial bootup create an init script.
1014
+
1015
+#+BEGIN_SRC: bash
1016
+editor /etc/init.d/tlsdate
1017
+#+END_SRC
1018
+
1019
+Add the following:
1020
+
1021
+#+BEGIN_SRC: bash
1022
+#!/bin/bash
1023
+# /etc/init.d/tlsdate
1024
+
1025
+### BEGIN INIT INFO
1026
+# Provides:          tlsdate
1027
+# Required-Start:    $remote_fs $syslog
1028
+# Required-Stop:     $remote_fs $syslog
1029
+# Default-Start:     2 3 4 5
1030
+# Default-Stop:      0 1 6
1031
+# Short-Description: Initially calls tlsdate with the timewarp option
1032
+# Description:       Initially calls tlsdate with the timewarp option
1033
+### END INIT INFO
1034
+
1035
+# Author: Bob Mottram <bob@robotics.uk.to>
1036
+
1037
+PATH='/usr/local/sbin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin'
1038
+
1039
+LOGFILE="/var/log/tlsdate.log"
1040
+TLSDATECOMMAND="tlsdate --timewarp -l -t -H www.ptb.de -p 443 >> $LOGFILE"
1041
+
1042
+#Start-Stop here
1043
+case "$1" in
1044
+  start)
1045
+    echo "tlsdate started"
1046
+    $TLSDATECOMMAND
1047
+    ;;
1048
+  stop)
1049
+    echo "tlsdate stopped"
1050
+    ;;
1051
+  restart)
1052
+    echo "tlsdate restarted"
1053
+    $TLSDATECOMMAND
1054
+    ;;
1055
+    *)
1056
+  echo "Usage: $0 {start|stop|restart}"
1057
+  exit 1
1058
+  ;;
1059
+esac
1060
+
1061
+exit 0
1062
+#+END_SRC
1063
+
1064
+Save and exit, then start the daemon.
1065
+
1066
+#+BEGIN_SRC: bash
1067
+chmod +x /etc/init.d/tlsdate
1068
+update-rc.d tlsdate defaults
1069
+service tlsdate start
1070
+#+END_SRC
1071
+
1013
 ** Install fail2ban
1072
 ** Install fail2ban
1014
 
1073
 
1015
 #+BEGIN_SRC: bash
1074
 #+BEGIN_SRC: bash