Pour définir la date, vous devez vous connecter en tant que root (ou su/sudo...)
echo "Time 1 hour ago ... $(date -d "$(date +%F\ %T) 1 hour ago")"
echo "Time now .......... $(date +%F\ %T)"
echo "Time in 1 hour .... $(date -d "$(date +%F\ %T) 1 hour")"
sudo date +%F\ %T -s "$(date -d "$(date +%F\ %T) 1 hour")"
echo "Adjusted time ..... $(date +%F\ %T)"
sudo date +%F\ %T -s "$(date -d "$(date +%F\ %T) 1 hour ago")"
echo "Re-adjusted time .. $(date +%F\ %T)"
sortie :
Time 1 hour ago ... 2012-04-16 21:31:53
Time now .......... 2012-04-16 22:31:53
Time in 1 hour .... 2012-04-16 23:31:53
[sudo] password for ....
Adjusted time ..... 2012-04-16 23:31:53
[sudo] password for ....
Re-adjusted time .. 2012-04-16 22:31:53