rsyslog message flow

message enter rsyslog with the help of input modules. Then, they are passed to ruleset, where rules are conditionally applied. when a rule matches, the message is transferred to an action, which then does something to the message, e.g. write it to a file or a database, or forward it to a remote host.

阅读全文 »

Install RHEL/Atomic host from ISO

  • making installation USB media
    • Find usb device name by dmsg or something like this.
      • connect usb device and see the dmsg last message.
  • login as root
  • make sure the usb device is not mounted.
    • findmnt /dev/sdb: if no output, it’s not mounted.
    • if it’s mounted, use unmount $target_name to unmount.
  • use dd command to write iso to usb
    • dd if=/path/to/image.iso of=/dev/sdb bs=521k
  • Reboot and enter boot menu, then select and use anaconda to install.
    阅读全文 »

简述:
  1. 硬件主动读取BIOS. BIOS会检测硬件并做自我测试.
  2. BIOS根据配置获取第一个可以启动的装置, 并读取运行第一个气动装置内MBR的boot loader(即grub)
  3. bootloader会把kernel解压并加载到内存中. kernel会检测硬件并安装驱动程序.
  4. 硬件驱动成功之后, kernel主动call init进程, init会获取run level
  5. init运行/etc/rc.d/rc.sysinit文件准备软件运行的作业环境(网络/时区等)
  6. init将run level的各个服务启动
  7. init运行/etc/rc.d/rc.local文件
  8. init运行终端模拟程序mingetty来启动login进程, 然后等待用户登陆.
    阅读全文 »

经常用的模块, 也是老用老忘, 用一次学一次. 写篇blog, 加深印象. refer to: python howto

argument和parameter的区别:

其实跟今天的主题没多大关系, 顺便说一下, 因为看一些英文的技术文章, 会经常用这两个概念.
parameter就相当于java里的”形参”:
方法/函数定义时在括号里的参数

1
2
def explain_param_vs_arg(param1, param2):
print param1, param2

argument就是所谓”实参”:
调用方法/函数时括号里的参数

1
explain_param_vs_arg("arg1", "arg2")

阅读全文 »

转自IBM开发者社区

使用pdb进行调试:

pdb 是 python 自带的一个包,为 python 程序提供了一种交互的源代码调试功能,主要特性包括设置断点、单步调试、进入函数调试、查看当前代码、查看栈片段、动态改变变量的值等。pdb 提供了一些常用的调试命令,详情见表 1。

  • 表 1. pdb 常用命令
命令 解释
break 或 b 设置断点 设置断点
continue 或 c 继续执行程序
list 或 l 查看当前行的代码段
step 或 s 进入函数
return 或 r 执行代码直到从当前函数返回
exit 或 q 中止并退出
next 或 n 执行下一行
pp 打印变量的值
help 帮助

下面结合具体的实例讲述如何使用 pdb 进行调试。

阅读全文 »