Giter VIP home page Giter VIP logo

remote-sh's Introduction

readme

这个服务用于执行linux脚本信息,同时实时在控制台显示结果,该服务可以动态加载新添加的脚本信息,但此脚本信息需要在config.json注册

the server is used to execute the linux bash and it can Print results can be displayed in real time

这个服务如果运行在ubuntu等服务器上,记得要打开相应端口号的防火墙,并且,如果通过ssh连接、执行,需要运行下面命令来保证server在断开ssh时不被杀掉nohup node /root/project/server/app.js & 或者 setsid node /root/project/server/app.js 开通防火墙响应端口可以点此查看

If the service is running in Ubuntu, remember to turn off the firewall on the response port. Also, when executing commands with SSH, you need to execute nohup node /root/project/server/app.js & or setsid node /root/project/server/app.js You can click here to activate the firewall response port.

注意:在app.js的47行spawn('sh', [./scripts/${filePath}]),你应该修改为绝对路径

Be careful: You should change the path to absolute path in app.js line 47 spawn('sh', [./scripts/${filePath}])

  • npm i to configure the environment 安装环境

  • npm start to start the server 启动服务

  • curl http://localhost:port can test case 测试服务

file:

  • app.js main file of the server

  • config.json the key is the id of file, value is the bash filename 键为脚本id,值为脚本名称

  • utility.js some tools we can use

  • scripts bash shell script

    • hello-world test script 测试

    • mongodump mongo data Backup Mongodb数据库备份

      DB_HOST='' # mongo host
      DB_NAME='' # mongo database
      
      OUT_DIR='' # Temporary catalogue
      TAR_DIR='' # Backup storage path
      
      DB_USER='' # mongo username
      DB_PASS='' # mongo user password
      DAYS=7 # Keep the file for 7 days 
      
  • docker_container

    • create docker container and Scheduled backup mongo(00:00 on every Friday)

    • do like this

        docker build -t cron-in-docker . # create docker images and contain
        docker run --rm -it cron-in-docker # Explicitly run the container to observe the results
    
  • ./scripts/kill_mongo_timeout.js

    • kill some timeout mongoshell
      • secs_runningsecs_running time about running
      • if weather ip is equal to xx or not

remote-sh's People

Contributors

sen520 avatar

Watchers

 avatar

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.