0

im not very clued up with telnet commands but i am looking to automate logins for a device we use in the field. we are having issues with Cmos batteries and every time the power goes out (6 times a day) we have to telnet into 2 devices then reset the dates on both of them.

im looking for a easy way to this like creating a .BAT file if possible.

usually like this

C:\Users\Administrator>Telnet 192.168.100.71

Debian GNU/Linux 3.0 quadras quadras login: root Password:desi

From here we type: date

then type: date -s "09 Jul 2022 10:55:00"

date gets changed and we type reboot.

Is there a way I can do this automatically. i appreciate any help given. TIA

Warren
  • 3
  • 2
  • You can pipe an input script into telnet. Where's your problem? You might also want to consider a UPS. – Zac67 Jul 09 '22 at 09:24
  • Ups is already being considered but client is currently out of money and we have to deal with it till December. This is the reason for asking here. Next. As I said I'm not to clued up with scripts. I don't know what you mean by "pipe an input script" consider me someone that has no knowledge of this stuff. – Warren Jul 09 '22 at 09:34
  • A small UPS is very rapidly less costly than paying people six times each day for a three-minute fix... – Zac67 Jul 09 '22 at 18:17

1 Answers1

0

You do not need to exec date command. The best is to install ntp software and sync time with time servers from internet.
Here is one manual how to do this for Debian.

(something like)

  1. Install ntp: apt-get install ntpd
  2. start ntpd: systemctl start ntpd
  3. check the status of ntp daemon: systemctl status ntpd
  4. check peer servers: ntpd -p
  5. In case of big time difference use ntpd -gq to force time set
Romeo Ninov
  • 5,263
  • 4
  • 20
  • 26