File: timedated

package info (click to toggle)
systemd 215-17%2Bdeb8u7
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 52,180 kB
  • ctags: 31,037
  • sloc: ansic: 192,918; xml: 39,605; sh: 13,002; makefile: 4,701; perl: 1,461; python: 1,355
file content (20 lines) | stat: -rwxr-xr-x 487 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
set -e

ORIG_TZ=`grep -v '^#' /etc/timezone`

# should activate daemon and work
STATUS=`timedatectl`
echo "$STATUS" | grep -q "Local time:"

# change timezone
OUT=`timedatectl set-timezone Europe/Moscow 2>&1`
[ -z "$OUT" ]
[ "`cat /etc/timezone`" = "Europe/Moscow" ]
STATUS=`timedatectl`
echo "$STATUS" | grep -q "Time.*zone: Europe/Moscow (MSK, +"

# reset timezone to original
OUT=`timedatectl set-timezone $ORIG_TZ 2>&1`
[ -z "$OUT" ]
[ "`cat /etc/timezone`" = "$ORIG_TZ" ]