我如何知道系统是否已开机? [英] How do I know if a system has powered on?

查看:106
本文介绍了我如何知道系统是否已开机?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个脚本,该脚本可以通过网络打开系统电源.然后,我需要在其他主机上运行一些命令.我如何知道系统是否已打开电源?

I am writing a script that powers on a system via network. And then i need to run a few commands on the other host. How do I know whether the system has powered on?

我的编程语言是Perl,目标主机是RHEL5.

My programming language is Perl and the target host is RHEL5.

是否有任何内核中断或网络启动信息指示系统已打开电源并且操作系统已加载?

Is there any kernel interrupt or network boot information that indicates the system has powered on and the os has loaded?

[在另一种情况下]我也想知道是否只是手动打开机器.确切地说是什么时候打开了电源.操作系统应该什么时候完全启动以进行与网络相关的操作,例如在那里执行网络命令.如果系统使用DHCP怎么办,远程系统将如何搜索该机器[我想可以通过mac地址访问.但是如果我错了].

[In a different scenario] I was also wondering just in case if i just switch on my Machine manually. when is it exactly said to have powered on. and when is the OS is supposed to have booted completely for a network related operation such as executing a network command there. What if the system is on DHCP how would a remote system then search for this machine [i guess it is possible via mac address. but if i am wrong ].

如果我错过任何信息,请随时问我.如果您有任何建议可以简化任务,请浮出水面:)

If I have missed out any info please feel free to ask me. If you have any suggestions to make the task easier please surface them :)

感谢 imkin

推荐答案

好吧,我想说系统可以执行您提出的请求时就被引导了.也就是说,sshd守护程序正在运行.为您的目的启动了足够的硬盘(我想-替代您真正需要的守护程序).

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).

因此,我将发送开机信号,并每隔15-30秒检查一次,以查看是否可以连接.如果在该机器的合理时间内(2分钟或5分钟或任何时间)都无法连接,那么我将向IT支持团队发送警报.好吧,我会先将其发送给自己,只有在调查了大约几处故障后,如果发现所有故障都是合法的,我才可以直接将其发送给IT部门.

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是一个不同的问题.您必须开始学习广播,或者在引导过程中在该计算机上有一个守护程序回拨"以注册其当前IP地址.每次DHCP更新更改其IP地址时,它都必须回拨".这无疑更加令人费解.尽可能避免在此类服务器计算机上使用DHCP.

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.

这篇关于我如何知道系统是否已开机?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆