You are Here:
Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section



Time/date script

Author (Read 6934 times)

0 Members and 1 Guest are viewing this topic.

Re: Time/date script
« Reply #3 on: March 29, 2017, 10:17:28 PM »
 

anon222

  • Muted
  • Gold Level Poster
  • *
  • 688
    Posts
  • Reputation: 192
  • Linux Lite Member
    • View Profile

  • CPU: Dual core Pentium E5700 3GHz

  • MEMORY: 3Gb

  • VIDEO CARD: GeForce GT 430
Thanks for a welcome.
No, I'm just visiting. Not using LL or ubuntu based any more, but I still recomend it to the new win$ows converts. You did a fine work on the bash scripts and they are evolving in a good direction.
Best regards
Misko
 

Re: Time/date script
« Reply #2 on: March 27, 2017, 10:02:52 PM »
 

ralphy

  • PayPal Supporter
  • Gold Level Poster
  • *****
  • 741
    Posts
  • Reputation: 117
  • Linux Lite Developer
    • View Profile
@misko_2083, welcome back!

Good to see you are coming back once again. I hope it is to stay :)
https://unlockforus.com

Sorry for seeming stupid and preferring Linux - I just don't know any better.

 

Time/date script
« Reply #1 on: March 27, 2017, 09:48:57 PM »
 

anon222

  • Muted
  • Gold Level Poster
  • *
  • 688
    Posts
  • Reputation: 192
  • Linux Lite Member
    • View Profile

  • CPU: Dual core Pentium E5700 3GHz

  • MEMORY: 3Gb

  • VIDEO CARD: GeForce GT 430
Hello agan Linux Lite community. It's been a long time. I had a hard time remembering the forum login password. ;D
Found this small remastersys-timedateset script by Tony Brijeski and switched it from yad to zenity.
Sets the time and date settings and syncs to hardware clock.
I hope you find it usefull.

Code: [Select]
#!/bin/bash

# Time, Date and Timezone configuration utility for Linux Lite
# Fork of Date and Time Setting Tool Copyright 2009,2011 by Tony Brijeski under the GPL V2
# TODO: add timezone settings, test on a live dvd, use image-list for the main dialog,

DIALOG="`which zenity` --width 400"
TITLE="--window-icon=/usr/share/icons/hicolor/24x24/apps/gnome-panel-clock.png  --print-partial --title="
TEXT="--text="
ENTRY="--entry "
ENTRYTEXT="--entry-text "
MENU="--list --print-column=1 --column=Pick --column=Info"
YESNO="--question "
MSGBOX="--info "
SCALE="--scale "
PASSWORD="--entry --hide-text "
TITLETEXT="Linux Lite Date and Time Setting Tool"

if [ $EUID -ne 0 ]; then
    gksu -m '
  <b>Lite Time requires Administrative privileges</b>
 
   
            Please enter your password to continue.' bash $0
         exit
     else :
fi


while [ "$SETCHOICE" != "Exit" ]; do
DAY="`date +%d`"
MONTH="`date +%m`"
YEAR="`date +%Y`"
MINUTE="`date +%M`"
HOUR="`date +%H`"

SETCHOICE=`$DIALOG --height 300 $TITLE"$TITLETEXT" $MENU $TEXT"Set Year Date and Time Tool\n\nTime=$HOUR:$MINUTE\nDate=$MONTH-$DAY-$YEAR\n\n" Exit "Quit" SETTIME "Set Current Time" SETDATE "Set Current Date"`
SETCHOICE=`echo $SETCHOICE | cut -d "|" -f 1`

if [ "$SETCHOICE" = "SETTIME" ]; then

HOUR="`date +%H`"
HOUR=`echo $HOUR | sed -e 's/^0//g'`

SETHOUR=`$DIALOG $TITLE"$TITLETEXT" $SCALE --value=$HOUR --min-value=0 --max-value=23 $TEXT"Move the slider to the correct Hour"`
if [ "$?" = "0" ]; then

if [ "${#SETHOUR}" = "1" ]; then
SETHOUR="0$SETHOUR"
fi

MINUTE="`date +%M`"
MINUTE=`echo $MINUTE | sed -e 's/^0//g'`
fi

SETMINUTE=`$DIALOG $TITLE"$TITLETEXT" $SCALE --value=$MINUTE --min-value=0 --max-value=59 $TEXT"Move the slider to the correct Minute"`
if [ "$?" = "0" ]; then

if [ "${#SETMINUTE}" = "1" ]; then
SETMINUTE="0$SETMINUTE"
fi

date $MONTH$DAY$SETHOUR$SETMINUTE$YEAR
hwclock --systohc
fi
fi

if [ "$SETCHOICE" = "SETDATE" ]; then
DAY="`date +%d`"
DAY=`echo $DAY | sed -e 's/^0//g'`
MONTH="`date +%m`"
MONTH=`echo $MONTH | sed -e 's/^0//g'`
YEAR="`date +%Y`"
SETYEAR=`$DIALOG $TITLE"$TITLETEXT" $SCALE --value=$YEAR --min-value=2000 --max-value=2020 $TEXT"Move the slider to the correct Year"`
if [ "$?" = "0" ]; then
SETMONTH=`$DIALOG $TITLE"$TITLETEXT" $SCALE --value=$MONTH --min-value=1 --max-value=12 $TEXT"Move the slider to the correct Month"`
if [ "$?" = "0" ]; then

if [ "${#SETMONTH}" = "1" ]; then
SETMONTH="0$SETMONTH"
fi


SETDAY=`$DIALOG $TITLE"$TITLETEXT" $SCALE --value=$DAY --min-value=1 --max-value=31 $TEXT"Move the slider to the correct Day"`
if [ "$?" = "0" ]; then

if [ "${#SETDAY}" = "1" ]; then
SETDAY="0$SETDAY"
fi


MINUTE="`date +%M`"
HOUR="`date +%H`"
date $SETMONTH$SETDAY$HOUR$MINUTE$SETYEAR
hwclock --systohc
fi
fi
fi
fi

done


exit 0
« Last Edit: March 27, 2017, 09:58:04 PM by misko_2083 »
 

 

-->
X Close Ad

Linux Lite 6.6 FINAL Released - Support for 22 Languages Added - See Release Announcement Section