环境:CentOS 5.5 和 6.4
我要求在安装前分析硬件,以确保我们的客户不会在不合标准的服务器硬件上安装我们的软件。例如,检查内存、磁盘空间、CPU、网卡……那么,我的 ks.cfg 文件中的 %pre 部分似乎是执行此操作的最佳位置???但是,我无法获得像 free to work 这样的命令...。我想找出 %pre 部分中可用的命令,这是在安装开始前执行硬件分析的正确位置吗???。 . 如果 ks.cfg 的 %pre 部分不是执行此操作的好地方,那么在哪里?这是我迄今为止尝试过的,但没有输出:
ks.cfg:
%pre
(echo "Analyzing Hardware...") >/dev/tty1
free >/dev/tty1
free_txt=`free -o`
(echo "$free_txt") >/dev/tty1
%end
Run Code Online (Sandbox Code Playgroud)
在安装的第一部分,我在屏幕上看到“分析硬件...”,但之后什么都没有.....
我正在使用 CentOS 6.4 并且read
在/etc/rc.local
文件中使用时有一个小问题。它将允许键盘输入,但在输入过程中不会回显任何击键。这在 CentOS 5.5 中运行良好。
有谁知道这里发生了什么?
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
echo -n "name? "
read name
echo "Name: $name"
touch /var/lock/subsys/local
Run Code Online (Sandbox Code Playgroud)
产生 ( /var/log/boot.log
):
name? Name: john
我目前正在从 CentOS 5.5 迁移到 6.4。将/etc/inittab 的内容转换为新贵很有趣。遇到了很多小问题,但现在我已经掌握了。我找到的最好的文档是针对 Ubuntu 的:
http://upstart.ubuntu.com/cookbook/#id416
它对我遇到的各种新贵问题很有帮助。唯一的问题是某些 ubuntu 项目不适用于 CentOS(无法使记录器功能正常工作,但找到了解决方法“exec >/dev/kmsg 2>&1”)。
是否有任何 CentOS 特定文档可以帮助处理新贵脚本?CentOS 需要与 Ubuntu 相同的文档..Argg!!
由于我是新贵的新手,我仍然不确定最佳实践是什么。下面的脚本似乎也很好用。欢迎对此发表任何评论..谢谢!!
这是一个启动 TTY 的脚本,用于向服务器提供调制解调器拨号服务。它可以为通过 USB、串行、网络调制解调器组(数字端口服务器)连接的调制解调器启动 TTY。它使用由管理员维护的文件来指定要启动的 tty:
/etc/init/ssi-ttys.conf:
start on stopped rc RUNLEVEL=[2345]
task
script
#--------------------------------------------------------------------
# The following exec will send the data to the kernels ring buffer.
# Once the syslog daemon starts, this data will be redirected to the
# system log file. So, the echo below will be written out to
# /var/log/messages. …
Run Code Online (Sandbox Code Playgroud) 我想在rpm规范文件的%pre和%post部分执行一些通用代码。当我在%pre部分放置一个子程序时,我需要将相同的子程序添加到RPM的%post部分。两次维护相同的子程序很糟糕。下面是一个例子:
RPM规范文件%pre和%post部分:
%pre
log_file=/var/log/myrpminstall.log
#-------------------------------------
# Send text log_file
#-------------------------------------
log_it() {
log_msg=$1
echo -e $log_msg >> $log_file
}
log_it "pre section log information"
%post
log_it "Post section log informations"
Run Code Online (Sandbox Code Playgroud)
目前,当rpm的%post部分在安装过程中执行时,我收到一条错误消息:
/var/tmp/rpm-tmp.36557: line 5: log_it: command not found
Run Code Online (Sandbox Code Playgroud)
那么,有没有办法让RPM 的所有部分(全局函数)都可以访问像log_it这样的子程序?目前,如果我想在%post部分使用它,我必须将log_it函数放在那里。
centos ×4
linux ×3
init-script ×1
kickstart ×1
rpm ×1
rpmbuild ×1
shell-script ×1
startup ×1
upstart ×1