使用的脚步有四个:【backup_unasyn.sh //备份所以执行的脚步
host_ip.sh //循环捕捉我服务器的ip进行
db_china.sh //服务器的hosts名
passwds.sh //登录服务器使用的密码
】
服务器结构:
IP1:113.11.226.112 IP2:113.11.226.113~1 ......
Linux 命令学习系列教程之apt命令详解
apt-cache search # ——(package 搜索包)
apt-cache show #——(package 获取包的相关信息,如说明、大小、版本等)
sudo apt-get install # ——(package 安装包)
sudo apt-get install # —–(package - - reinstall 重新安装包)
sudo apt-get -f install # —–(强制安装?#”-f = –fix-missing”当是修复安装吧…)
sudo apt-get remove #—–(package 删除包)
sudo apt-get remove - - purge # ——(package 删除包,包括删除配置文件等)
sudo apt-get autoremove –purge # —-(package 删除包及其依赖的软件包+配置文件等(只对6.10有效,强烈推荐))
sudo apt-get update #——更新源
sudo apt-get upgrade #——更新已安装的包
sudo apt-get dist-upgrade # &mda ......
#pragma once
#include <pthread.h>
class ThreadWrapper
{
public:
virtual ~ThreadWrapper();
static void EnterFunc(void *p);
int Open();
int Close();
bool TestCancel();
void Wait();
virtual void Svc();
protected:
ThreadWrapper();
private:
bool m_stillOpen;
int m_threadNum;
pthread_t m_handle;
};
*************************************************
#include "ThreadWrapper.h"
ThreadWrapper::ThreadWrapper()
: m_stillOpen(false)
{}
ThreadWrapper::~ThreadWrapper()
{
if(m_stillOpen)
{
Close();
Wait();
}
}
/*
Functional: The enter function of the thread.
*/
void ThreadWrapper::EnterFunc (void *p)
{
  ......
使用select函数可以以非阻塞的方式和多个socket通信。程序只是演示select函数的使用,功能非常简单,即使某个连接关闭以后也不会修改当前连接数,连接数达到最大值后会终止程序。
1. 程序使用了一个数组fd_A,通信开始后把需要通信的多个socket描述符都放入此数组。
2. 首先生成一个叫sock_fd的socket描述符,用于监听端口。
3. 将sock_fd和数组fd_A中不为0的描述符放入select将检查的集合fdsr。
4. 处理fdsr中可以接收数据的连接。如果是sock_fd,表明有新连接加入,将新加入连接的socket描述符放置到fd_A。
缺点: 连接数没有动态管理,当结束一个连接时要执行conn_amount--;
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define MYPORT 1234 // the port users will be connecting to
#define BACKLOG 5 // how many pending connections queue will hold
#define BUF_SIZE 200
int fd_A[BACKLOG]; // accepted connec ......
Top five things Linux can learn from Microsoft
Jul. 20, 2006
Linux does a lot of things right -- open-source
,
security, reliability -- but it's far from perfect. In fact, Linux and
its vendors could stand to learn a few things from Microsoft. Yes,
Microsoft. Like what? Here's my list of the top five things that Linux
could learn from Microsoft.
1. MSDN
Spread the word:
digg this story
With Linux and open-source software
,
all the code is open, so any developer can leap right in and start
working. That's grand, but what if you don't know where to start? What
if you're not really sure, or perhaps not too sure, about what's the
right way to program for a given project? What if you want to write
something new and useful... but you discover three months into your
project that you're duplicating work that's been done a dozen times
over?
There are no easy-to-use guides on how to program
......
在虚拟机上实验,每次启动时都需要很长的时间。 尤其是在启动sendmail 服务的时候,因为实验中也用不到这个。 所以就想把sendmail 停了,节省点资源和时间。
1. 结束sendmail 服务:
# killall sendmail
2. 在自动启动中删除sendmail:
chkconfig --del sendmail
3. 禁用sendmail:
chkconfig sendmail off
......