Sample Header Ad - 728x90

Invalid date when setting one computer's clock from another

4 votes
2 answers
364 views
I have the following code in a Bash script, which takes the current date/time and sets it via SSH on a target computer:
ssh @ "date --set '$(date)'"
This was working fine with various Ubuntu distros, but recently the target changed to another flavour of Linux and I get "invalid date" error. What is the correct way to do this, which should work for any version of Linux?
Asked by Richard Whitehead (161 rep)
Sep 24, 2024, 01:18 PM
Last activity: Sep 24, 2024, 08:30 PM