I need to set date and time in my server in order to make them synced always. I cannot use ntp inside my channel due to proxy issues. I've found this workaround. It works fine when I run it in command line interface. However when I add that command into a crontab job it work unexpectedly ie. set's time 00:00:00 whenever it is run.
This is my command in crontab:
*/1 * * * * date -s "$(curl -sD - google.com | grep '^Date:' | tr -d '\r,' | awk '{print $2, $4, $3, $6, $7, $5}')"
I also tried to run as a shell script like:
*/1 * * * * /usr/local/sbin/test.sh
No luck! So how can I solve this problem? What is wrong with my crontab job?