]>
git.ipfire.org Git - people/mfischer/ipfire-2.x.git/blob - src/scripts/settime
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 3 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
23 green
=$
(cat /var
/ipfire
/ethernet
/settings |
grep GREEN_NETADDRESS
)
24 if [ -z "$green" ]; then
27 green
=${green##*=}; green
="${green%.*}.[0-9]"
28 if [ -n "$(cat /var/ipfire/time/settime.conf | grep $green)" ]; then
29 ongreen
=0 # NTP on Green
34 orange
=$
(cat /var
/ipfire
/ethernet
/settings |
grep ORANGE_NETADDRESS
)
35 if [ -z "$orange" ]; then
38 orange
=${orange##*=}; orange
="${orange%.*}.[0-9]"
39 if [ -n "$(cat /var/ipfire/time/settime.conf | grep $orange)" ]; then
40 onorange
=0 # NTP on Orange
45 tlanguage
=$
(cat /var
/ipfire
/main
/settings |
grep LANGUAGE
)
46 tlanguage
=${tlanguage##*=}
49 if [ -e /var
/ipfire
/red
/active
] ||
[ "$ongreen" -eq 0 ] ||
[ "$onorange" -eq 0 ]; then
50 /usr
/bin
/ntpdate
-su $1 $2
53 if [ "$ntpdatetest" -eq 0 ]; then
55 en
) date "+%X %Z on %d %B %Y" > /var
/lock
/time
/lastset
;
56 logger
-t ipfire
"NTP synchronisation event" ;;
57 de
) date "+%X Uhr am %d.%m.%Y" > /var
/lock
/time
/lastset
;
58 logger
-t ipfire
"NTP Synchronisierung" ;;
59 * ) date "+%X %Z, %Y-%m-%d" > /var
/lock
/time
/lastset
;
60 logger
-t ipfire
"NTP synchronisation" ;;
63 /sbin
/hwclock --systohc
64 rm -f /var
/lock
/time
/settimenow
65 # reset counter variable
66 cp /var
/ipfire
/time
/counter.conf
/var
/lock
/time
/counter
69 de
) logger
-t ipfire
"ntpdate fehlerhaft" ;;
70 * ) logger
-t ipfire
"ntpdate error" ;;
75 echo Missing parameter