redhat

shell编写一个判断脚本

隐身守侯 提交于 2019-12-05 17:25:25
shell编写一个判断脚本 4.1 问题 本例要求在虚拟机 server0 上创建 /root/foo.sh 脚本,任务目标如下: 当运行 /root/foo.sh redhat ,输出为 fedora 当运行 /root/foo.sh fedora ,输出为 redhat 当没有任何参数或者参数不是 redhat 或者 fedora 时,其错误输出产生以下信息: /root/foo.sh redhat|fedora 4.2 方案 Shell 脚本中执行条件测试的方式: 任何一条命令行 test 测试表达式 [ 测试表达式 ] 常用的 test 测试选项: 文件状态检测 -f 、 -d 、 -e 、 -r 、 -w 、 -x 整数值比较 -gt 、 -ge 、 -eq 、 -ne 、 -lt 、 -le 字符串比较 == 、 != 取反操作 ! 多分支 if 选择结构: if 条件测试操作 1;then 命令序列 1.... elif 条件测试操作 2;then 命令序列 2.... else 命令序列 3.... fi 4.3 步骤 实现此案例需要按照如下步骤进行。 步骤一:编写 foo.sh 判断脚本 1 )编写脚本代码 [root@server0~]#vim /root/foo.sh #!/bin/bash if [$#-eq 0];then echo "/root/foo

What would cause PHP variables to be rewritten by the server?

限于喜欢 提交于 2019-12-05 17:12:06
问题 I was given a VM at my company to install web software on. But I came across a rather bizarre issue where PHP variables would be overwritten (rewritten) by the server if they matched a specific pattern. What could rewrite PHP variables like this? The following is as an entire standalone script. <?php $foo = 'b.domain.com'; echo $foo; // 'dev01.sandbox.b.domain.com' $bar = 'dev01.sandbox.domain.com'; echo $bar; // 'dev01.sandbox.sandbox.domain.com' $var = 'b.domainfoo.com'; echo $var; // 'b

How to detect upgrade when an RPM that obsoletes another RPM is being installed

一曲冷凌霜 提交于 2019-12-05 16:29:34
RPM scriptlets are passed in $1 ( the number of packages of this name which will be left on the system when the action completes ) so they can determine whether a package upgrade or removal is occurring. For reasons outside my control, I believe the next version of the package may have a different package name than the first version. I tried to create a new package that "obsoletes" the old one and upgraded using it. However, the old package postun scriptlet still got $1 == 0 and my postun cleanup script ran. This is a bit of an edge case, because technically there are 0 packages with that name

centos修改主机名整理(勿喷)

廉价感情. 提交于 2019-12-05 14:24:38
1.临时修改主机名 显示主机名: spark @ master :~$ hostname master 修改主机名: spark@ master :~$ sudo hostname hadoop spark @master :~$ hostname hadoop PS:以上的修改只是临时修改,重启后就恢复原样了。 2.永久修改主机名 redhat/centos上永久修改 [root @localhost ~]# cat /etc/sysconfig/network NETWORKING=yes HOSTNAME=localhost.localdomain GATEWAY=192.168.10.1 修改network的HOSTNAME项。点前面是主机名,点后面是域名。没有点就是主机名。 [root @localhost ~]# vi /etc/sysconfig/network NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=master 这个是永久修改,重启后生效。目前不知道怎么立即生效。 想立即生效,可以同时采用第一种方法。 还有一个修改是: /etc/hosts 127.0.0.1 localhost.localdomain 127.0.0.1后面的那一部分。 deb/ubuntu上修改 : hostname localhost

Address Out of bounds error when reading xml

寵の児 提交于 2019-12-05 08:40:33
I am getting a weird segfault when using libxml to parse a file. This code worked previously when I compiled it as a 32bit application. I changed it to a 64 bit application and it stops working. The seg fault comes in at "if (xmlStrcmp(cur->name, (const xmlChar *) "servers"))" cur->name is a const xmlChar * and it points to an address that says its out out bounds. But when I debug and go to that memory location, that data is correct. int XmlGetServers() { xmlDocPtr doc; xmlNodePtr cur; doc = xmlParseFile("Pin.xml"); if (doc == NULL) { std::cout << "\n Pin.xml not parsed successfully." << std:

centos/redhat 7 配置ssh免密登陆

安稳与你 提交于 2019-12-05 06:35:09
two servers: A and B A want to login B witout passwd 1、确保AB都安装了openssh 2、A创建ssh密钥对:ssh-keygen -t rsa, 然后一路enter 3、B里创建.ssh目录和authorized_keys文件,然后修改权限 mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys 4、将A创建的公钥rsa_rsa.pub传到B的authorized_keys里面。可通过 来源: https://www.cnblogs.com/ValyrianSteel/p/11910957.html

Compiling C++11 on g++ 4.4.7 in Red Hat linux [closed]

风格不统一 提交于 2019-12-05 05:20:03
I have already tried: g++ -std=c++11 my_file.cpp -o my_prog g++ -std=c++0x ... g++ -std=gnu++0x ... and I keep getting this message: error: unrecognized command line option C++0x/C++11 Support in GCC From there you can see that C++11 is supported since gcc 4.7 and gcc 4.4 has C++0x support. Quote from Status of Experimental C++0x Support in GCC 4.4 : GCC provides experimental support for the upcoming ISO C++ standard, C++0x. This support can be enabled with the -std=c++0x or -std=gnu++0x compiler options; the former disables GNU extensions. So it should work with -std=c++0x or -std=gnu++0x .

Running “npm” returns “Error: Cannot find module 'inherits'”

久未见 提交于 2019-12-05 04:32:01
module.js:340 throw err; ^ Error: Cannot find module 'inherits' at Function.Module._resolveFilename (module.js:338:15) at Function.Module._load (module.js:280:25) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (/usr/lib/node_modules/npmconf/npmconf.js:3:16) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) The following worked for me. The other answer, sudo yum install nodejs-inherits*, did not do

redhat磁盘检验、挂载与卸载

[亡魂溺海] 提交于 2019-12-05 02:54:38
磁盘检验 fsck(file system check)用来检查和维护不一致的文件系统。 若系统掉电或磁盘发生问题,可利用fsck命令对文件系统进行检查。 语法: fsck [-t 文件系统] [-ACay] 装置名称 选项与参数: -t : 给定档案系统的型式,若在 /etc/fstab 中已有定义或 kernel 本身已支援的则不需加上此参数 -s : 依序一个一个地执行 fsck 的指令来检查 -A : 对/etc/fstab 中所有列出来的 分区(partition)做检查 -C : 显示完整的检查进度 -d : 打印出 e2fsck 的 debug 结果 -p : 同时有 -A 条件时,同时有多个 fsck 的检查一起执行 -R : 同时有 -A 条件时,省略 / 不检查 -V : 详细显示模式 -a : 如果检查有错则自动修复 -r : 如果检查有错则由使用者回答是否修复 -y : 选项指定检测每个文件是自动输入yes,在不确定那些是不正常的时候,可以执行 # fsck -y 全部检查修复。 实例 1 查看系统有多少文件系统支持的 fsck 命令: [root@www ~]# fsck[tab][tab] fsck fsck.cramfs fsck.ext2 fsck.ext3 fsck.msdos fsck.vfat 实例 2 强制检测 /dev/hdc6 分区:

查看Linux内核版本命令

北慕城南 提交于 2019-12-05 01:53:36
一、查看 Linux 内核版本命令(两种方法): 1、cat /proc/version 2、uname -a 二、查看Linux系统版本的命令(3种方法): 1、lsb_release -a即可列出所有版本信息: 这个命令适用于所有的Linux发行版,包括Redhat、SuSE、Debian…等发行版。 2、cat /etc/redhat-release这种方法只适合Redhat系的Linux: 3、cat /etc/issue此命令也适用于所有的Linux发行版。 来源: https://www.cnblogs.com/exmyth/p/11896114.html