Code Monkey home page Code Monkey logo

srunclient's Introduction

SrunClient

简易版深澜命令行客户端,包含登录登出和查询在线信息功能。支持 windows/Linux/?MacOS,python2/3 。 包含校园内网服务器反向代理教程。

how to use

  1. 使用命令行客户端登录登出 更换srun_ip为自己学校对应的深澜网关地址

    class SrunClient:
    
        name = 'CUGB'
        srun_ip = '202.204.105.195' # or srun_ip = 'gw.cugb.edu.cn'
    
        login_url = 'http://{}/cgi-bin/srun_portal'.format(srun_ip)
        online_url = 'http://{}/cgi-bin/rad_user_info'.format(srun_ip)
        headers = {'User-Agent': 'SrunClient {}'.format(name)}

    然后运行srun.py

    [user@host SrunClient]$ python srun.py
    ############### Wellcome to Srun Client ###############
    [1]: show online information
    [2]: set username and passwd
    [3]: login
    [4]: logout
    [h]: show this messages
    [q]: quit
    #######################################################
    [SrunClient CUGB] ###*** NOT ONLINE! ***###
    >
    
  2. 掉线自动重连

    • 🍬推荐🍬 定时任务,定时执行heartbeat.py。
      使用crontba添加定时任务
      [user@host SrunClient]$ crontab -e
      将下列命令添加,按esc,输入:wq退出保存(每分钟执行一次命令)。
      * * * * * python /path/to/heartbeat.py
      
    • 或配合nohup使用,每隔10秒钟检测一次在线情况,不在线则重新登录。在heartbeat.py中设置好登录账号和密码之后,运行:
      nohup python heartbeat.py &
      nohup 进程有被杀死的风险

addition

to do

  • 定时下线
  • 更换ip

srunclient's People

Contributors

ice-tong avatar

Stargazers

Songyu Shen avatar

Watchers

James Cloos 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.