Code Monkey home page Code Monkey logo

wsl-watchdog's Introduction

WSL-WatchDog

monitor wsl: start or restart wsl automatically, update or create firewall rules & proxy, create scheduled task...

Why ?

the latest version of wsl stops if you are not connected to the console, or if there is not a job / process a foreground (it can be just a loop in a shell for example)

My need :

  • have a linux wsl running in the background
  • that wsl can be launched when windows is launched
  • a scheduled task check every xx minutes that wsl run
  • create / recreate the firewall rules
  • create / recreate portproxy v4tov4 rules
  • change the @IP address of the vEthernet card (WSL) and disable the @IP V6 if necessary
  • store wsl, scheduled task, firewell rules, etc settings in yaml file

What should you do in the linux distribution ?

Create a start.sh file, you can change the name (see in the yaml file in WSLCommon/StartWSL), in which you will have to launch a process or create an infinite loop for WSL to remain active.

What wsl_watchdog.ps1 does ?

  • An elevation of privilege (admin) if necessary like "run as administrator" reads wsl_params.yml
  • load wsl_params.yml
  • check if the wsl distribution is active (see Distro in wsl_params.yml)
  • check Firewall rules (see Ports in wsl_params.yml)
  • check Forwardings rules (see ProxyV4 in wsl_params.yml)

What do you need to ro create wsl_watchdog sheduled task : ?

Install Powershell-Yaml

  • In PowerShell as Administrator

    Install-Module powershell-yaml

Edit wsl_params.yml for the WSL distro to use and the location of WSL-Watchdog scripts. wsl --list shows installed distros.

Call wsl_create_task.ps1. This script read thle yaml file wsl_params.yml, create wsl_watchdog task with 2 triggers :

  • atstartup : to start wsl_watchdog.ps1 script
  • daily : start wsl_watchdog.ps1 script evry 5mn (see TaskDuration in wsl_params.yml)

wsl-watchdog's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

thebalaa corrigat

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.