I wrote this script for setting the system time, I'm assuming that's what you're trying to do, this include the right commands in the right order:
Code:
#!/bin/sh
# set the system time and date
# make sure we are root
if test ~ != '/root'
then
echo 'ERROR: You must be root to run this script' >&2
# fail
exit 1
fi
# read user input
printf 'Enter month as ## => '
read month
printf 'Enter day as ## => '
read day
printf 'Enter year as #### => '
read year
printf 'Enter hour out of 24 as ## => '
read hour
printf 'Enter minute as ## => '
read minute
printf 'Enter second as ## => '
read second
echo "Press <Enter> when you want to set the time to $month/$day/$year $hour:$minute:$second"
read dummy
# set date and time, and fix hwclock
date -s "$month/$day/$year $hour:$minute:$second"
/sbin/hwclock -r
/sbin/hwclock --adjust
/sbin/hwclock --systohc
echo 'System time is set. Settings will be in full effect on next reboot.'
# success
exit 0