Yasin Kumar
Yasin Kumar

Reputation: 189

How to set time in Linux by Bash that not change after reboot?

I'm trying to code a bash script that set Time and Date manually, this work but after reboot my system (Ubuntu 18.04) time and date resets to automatic mode. How I can write a bash for set time/date that not change after reboot?

My try as a beginner ended to this Bash script:

#!/bin/bash
# A simple bash script to set system date & time
timedatectl set-ntp 0
date +%Y%m%d -s $1
date +%T -s $2":00"

Upvotes: 0

Views: 3295

Answers (2)

Yasin Kumar
Yasin Kumar

Reputation: 189

I done it by using Hard Ware Clock.

Upvotes: 0

samthegolden
samthegolden

Reputation: 1490

timedatectl set-ntp 0 && timedatectl set-time 'HH:MM:SS' will turn off web clock sync and let you update it manually.

Upvotes: 2

Related Questions