I have two computers (let's call them master and slave) connected via ethernet with static IP addressing.
What I want to achieve is to reboot slave whenever master is rebooted, and power it off whenever master is powered off.
Both systems are runinng Ubuntu Bionic with systemd.
So far I only concentrated on the rebooting. I created file
/lib/systemd/system/restart-jetson.service with the following contents:
[Unit] Description=Restart Jetson DefaultDependencies=no Before=systemd-reboot.service # also tried just reboot.service Requires=network.target After=network.target [Service] ExecStart=/bin/su -c 'echo "nvidia" | /usr/bin/ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no nvidia@%H-jetson "sudo -S reboot"' robot Type=oneshot RemainAfterExit=yes [Install] WantedBy=reboot.target
Then I enabled the service with
systemctl enable restart-jetson.service and
SSH is configured for passwordless login on slave.
If I restart the service from a running system, slave is rebooted. However, rebooting the master system does nothing to the slave. How should I configure this systemd unit correctly?
Other SO posts or tutorials seem like this method should work, but for this particular use-case it doesn't seem to do anything.