How do I know if a system has powered on?

☆樱花仙子☆ 提交于 2019-12-03 13:06:33

Well, I'd say the system is booted when it can perform the request you've made of it. That is, the sshd daemon is running. That's booted sufficiently for your purposes (I assume - substitute for whatever daemon you really need).

So, I'd send the power-on signal, and check back every 15-30 seconds to see if I could connect. If I've failed to connect within whatever is a reasonable time for that machine (2 minutes or 5 minutes or whatever), then I'd send an alert to the IT support team. Well, I'd send it to myself first, and only once I've investigated a few failures or so and found them to all be legitimate would I start sending it directly to IT.

DHCP is kind of a different question. You'd have to start learning about broadcasting, or having a daemon on that machine "call home" during boot to register its current IP address. And it would have to "call home" every time a DHCP renewal changed its IP address. This is decidedly more convoluted. Try to avoid DHCP on such server machines if at all possible.

On the rebooting machine you can install a script in your crontab with the special @reboot assertion (see man 5 crontab). That script could send a notification of some kind to the other machine, notifying it that it's up now.

I think checking for sshd sounds like a good approach.

As for the DHCP problem: if the other computer is on the same subnet you can look it up by MAC address using Net::ARP.

How about adding a script to the remote machine which gets run on startup to have it tell you when it is ready.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!