i modify system time 2 days after find can set time specific time date
command in solaris:
#date mmddhhmmyy
but cannot add 2 days on current time. there easy way task shell command? if know similar in linux, please share me.
solaris date supports syntax gradually adjusts time. may best bet.
date -a $(( 48 * 60 * 60 * 60 ))
should eventually update date 2 days ahead. best way set system time gradually update instead of jumping ahead (which can screw bunch of running programs).
barring that, write nice script that's aware of days in month, , leap years, , calculations yourself. if you're exceptionally lazy (like me) , precision , race conditions don't bug (like me, answering stackoverflow questions), hack this:
#!/bin/sh now=$(date +%h%m.%s) # current time date 2359.59 # set time 11:59:59pm sleep 1 # wait second day rolls on date 2359.59 # set time 11:59:59pm sleep 1 # wait second day rolls on date "$now" # set time was, in new day date -a 2 # gradually add 2 seconds clock
test run on tnarik/solaris10-minimal
vagrant box:
# ./adddaystodate current date monday, 25 january 2016 00:46:59 gmt monday, 25 january 2016 23:59:59 gmt tuesday, 26 january 2016 23:59:59 gmt wednesday, 27 january 2016 00:46:59 gmt current date wednesday, 27 january 2016 00:46:59 gmt
Comments
Post a Comment