2、安装依赖包;
3、修改系统内核参数文件:sysctl.conf;
4、修改用户资源限制文件:limits.conf;
5、创建安装目录(CentOS下测试发现不需要)、配置系统变量(可以安装完成后配置);
6、安装Oracle软件;
在Unix/Linux下,并没有提供int kbhit(void)这个函数。在linux下开发控制台程序时,需要自己编写kbhit()实现的程序了。下面是kbhit在Unix/Linux下的一个实现。用到了一种终端 *** 作库termios。下面是头文件kbhit.h:QUOTE:#ifndef KBHITh#define KBHIThvoid init_keyboard(void)void close_keyboard(void)int kbhit(void)int readch(void)#endif下面式源程序kbhit.c:QUOTE:#include "kbhit.h"#include <stdio.h>#include <termios.h>static struct termios initial_settings, new_settingsstatic int peek_character = -1void init_keyboard(){tcgetattr(0,&initial_settings)new_settings = initial_settingsnew_settings.c_lflag &= ~ICANONnew_settings.c_lflag &= ~ECHOnew_settings.c_lflag &= ~ISIGnew_settings.c_cc[VMIN] = 1new_settings.c_cc[VTIME] = 0tcsetattr(0, TCSANOW, &new_settings)}void close_keyboard(){tcsetattr(0, TCSANOW, &initial_settings)}int kbhit(){unsigned char chint nreadif (peek_character != -1) return 1new_settings.c_cc[VMIN]=0tcsetattr(0, TCSANOW, &new_settings)nread = read(0,&ch,1)new_settings.c_cc[VMIN]=1tcsetattr(0, TCSANOW, &new_settings)if(nread == 1) {peek_character = chreturn 1}return 0}int readch(){char chif(peek_character != -1) {ch = peek_characterpeek_character = -1return ch}read(0,&ch,1)return ch}现在的Linux *** 作系统基本上都用systemd管理服务了,这玩意本身就自带服务挂了自动重启功能。只需要配置一个on-failure属性即可。如果你想把你的程序变成服务,建议抽点时间学学systemd,不会占用你太多时间。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)