Coder Social home page Coder Social logo

online-update-server's Introduction

online-update-server

##简介 这是一个简单的在线更新程序,无需停止server的运行,即可更新serve代码。在更新过中保持socket的open,不断接受client的请求并缓存, 待server重启成功后统一处理。 ##使用说明 ###环境 fedora

boost

g++ ###server 生成可执行文件并执行:

 g++ -o server server.cpp -lboost_thread -lboost_system && ./server

###client 生成可执行文件并执行:

g++ -o client client.cpp && ./client

##执行结果 ###cmd输出

[qingze@localhost socket]$ g++ -o client client.cpp && ./client
send message...
send message...
send message...
send message...
send message...
send message...
send message...
send message...
send message...
...

###查看日志

[root@localhost socket]# journalctl --since 15:07
-- Logs begin at Wed 2014-12-24 03:16:02 CST, end at Mon 2015-03-09 15:07:51 CST. --
Mar 09 15:07:51 localhost.localdomain myServer[787]: set signal ok...

###查看输出文件

[root@localhost log]# cat /tmp/output 
7f2340552700  / test Mon Mar  9 15:09:20 2015
7f2340552700  / test Mon Mar  9 15:09:21 2015
...

###更新程序

kill -SIGALRM PID

pid根据系统中server的进程ID替换 ##帮助 如程序运行发生任何问题,请使journalctl命令查看系统日志

online-update-server's People

Contributors

qingzew avatar

Stargazers

 avatar  avatar

Watchers

 avatar

online-update-server's Issues

fork有问题吧

fork是在当前运行中进程的镜像基础上创建相同的子进程,然后老的父进程退出。但并没有重新加载程序代码,没有实现程序版本更新。没有意义。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.