#!/bin/bash

if [ -z "$i" ]; then
	echo "usage: $0 <new-test-name>"
	exit 1
fi
testuser="$1"

# echo "Pacific/Samoa" > /etc/timezone
echo "America/New_York" > /etc/timezone
ln -fs /usr/share/zoneinfo/`cat /etc/timezone` /etc/localtime
# debconf-set-selections <<%EOF
# tzdata tzdata/Areas select America
# tzdata tzdata/Zones/America select New_York
# %EOF
dpkg-reconfigure -f noninteractive tzdata
/etc/init.d/univention-s4-connector restart
pkill -f cli-server

udm users/user create --set username="$testuser" --set lastname=name1 --set password=univention  --set userexpiry="2018-03-31"

udm users/user list --filter uid="$testuser" | sed -n 's/  userexpiry: //p'
sleep 5
udm users/user list --filter uid="$testuser" | sed -n 's/  userexpiry: //p'
sleep 10
udm users/user list --filter uid="$testuser" | sed -n 's/  userexpiry: //p'
sleep 10
udm users/user list --filter uid="$testuser" | sed -n 's/  userexpiry: //p'
sleep 10
udm users/user list --filter uid="$testuser" | sed -n 's/  userexpiry: //p'

echo "Europe/Berlin" > /etc/timezone
ln -fs /usr/share/zoneinfo/`cat /etc/timezone` /etc/localtime
# debconf-set-selections <<%EOF
# tzdata tzdata/Areas select Europe
# tzdata tzdata/Zones/Europe select Berlin
# %EOF
dpkg-reconfigure -f noninteractive tzdata
/etc/init.d/univention-s4-connector restart
pkill -f cli-server
