debian是使用monit来实现对允许的程序进行监控,并能实现自动重启。
另外在/etc/inittab,使用respawn选项,也可以实现对程序的实时监控。
watchdog实现的目标是对系统的状态进行监控,当出现异常时可以重启操作系统,并不适合对进程状态的监控。
2009年1月4日星期日
2008年8月26日星期二
在kernel2.6下编译lkm
相对于2.4,init_module和cleanup_module,改名为module_init(),module_exit().
在编译时,需要编写Makefile文件,而不能直接使用gcc。
最为简单的Makefile文件
#cat Makefile
obj-m := hello.o
cat hello.c
/* for 2.6 */
#include
#include
static int myinit_module()
{
printk(”hello!This is a testing module!\n”);
return 0;
}
static void mycleanup_module()
{
printk(”Sorry ! The testing module is unloading now! \n”);
}
module_init(myinit_module);
module_exit(mycleanup_module);
编译时的命令为:make -C /usr/src/linux(源码版本) SUBDIRS=$PWD modules
加载,删除模块
sudo insmod hello.ko
sudo rmmod hello
dmesg /*查看printk打印出的信息*/
在编译时,需要编写Makefile文件,而不能直接使用gcc。
最为简单的Makefile文件
#cat Makefile
obj-m := hello.o
cat hello.c
/* for 2.6 */
#include
#include
static int myinit_module()
{
printk(”hello!This is a testing module!\n”);
return 0;
}
static void mycleanup_module()
{
printk(”Sorry ! The testing module is unloading now! \n”);
}
module_init(myinit_module);
module_exit(mycleanup_module);
编译时的命令为:make -C /usr/src/linux(源码版本) SUBDIRS=$PWD modules
加载,删除模块
sudo insmod hello.ko
sudo rmmod hello
dmesg /*查看printk打印出的信息*/
订阅:
博文 (Atom)