View Single Post
Old 09-29-2016, 04:12 AM   #251
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
Quote:
Originally Posted by Alan_S View Post
How we can make script to automatically use both these commands?

For example, name of the script would be settime.sh, it would be run with same parameters as date (settime 23:12:11) and it would automatically set date to that time and afterward execute hwclock command.

Code:
#!/bin/sh

date $1
hwclock -w -u
How can I best run my newly created script settime.sh from KSM, or its terminal? Any suggestion how to set this up to easily set both system and hardware clock?
I guess this should work:
Code:
#!/bin/sh
date "$*" 2>/dev/null && hwclock -w -u
I am unable to test it now.
tshering is offline   Reply With Quote