设法杀死了远程机器上的 sshd(通过运行一个使用机器中所有可用内存的脚本,哎呀......)该 sshd 始终保持运行。
除了每 n 分钟或几小时重新启动 sshd 的 hacky cron 作业之外,使用 inittab 来获取 init 以保持 sshd 运行似乎是一个好主意。
这种方法有什么缺点吗? Linux 发行版在默认情况下这样做似乎是明智的,因为 sshd 通常是机器唯一可用的访问方法。
此外,还有其他守护进程我应该使用这种方法吗?也许是nagios的nrpe之类的监控代理?
[1] 是的,管理卡或网络电源开关是个好主意,但当时它们被认为是“不必要的”……
我喜欢在服务出现故障时重新生成服务。我已将它添加到inittab但是我无法在需要时杀死它。
有没有我可以重生一个服务,但是可以在我需要的时候手动杀死它。
提前致谢
如果我从命令行执行它,我有一个可以正常工作的命令......但是当我把它放在一个 init.d 脚本中时它不会启动(好吧..它启动但具有与运行时不同的行为直接地)。
知道为什么这不适用于 init 脚本吗?
命令是: bluepill load /var/www/html/bluepill.conf
init.d 脚本是:
#!/bin/sh
## Based on http://www.novell.com/coolsolutions/feature/15380.html
# chkconfig: 345 99 1
# processname: solr
# Provides: bluepill
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: bluepill daemon, providing process monitoring
# Description: Bluepill
# Check for missing binaries
BLUEPILL_BIN=/usr/local/bin/bluepill
test -x $BLUEPILL_BIN || { echo "$BLUEPILL_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check …Run Code Online (Sandbox Code Playgroud)