Comments (8)
This will be a chore to implement. If someone wanted to take this on, you could look at utilizing https://github.com/sevlyar/go-daemon
from mole.
We're getting there... so, every detached mole instance will have an identifier associated with it and the identifier will be generated either from the alias name or random combination of characters.
Mole would store information about the detached instances under $HOME/.mole/instances
.
Each detached instances would have its own directory under $HOME/.mole/instances
named after its identifier and the specific instance directory would have a file named mole.pid
to store the process identifier, pid, making easier to save/retrieve it.
Examples:
$ mole -start example1 -detach
$ tree $HOME/.mole
$ tree ~/.mole
$HOME/.mole
└── instances
└── example1
└── pid
$ mole -stop example1
$ tree $HOME/.mole
tree ~/.mole
$HOME/.mole
└── instances
$ mole -detach -remote :3306 -server my-server
mole is running under the alias 10df414a.
Execute "mole -stop 10df414a" if you like to stop it at any time
$ tree $HOME/.mole
$ tree ~/.mole
$HOME/.mole
└── instances
└── 10df414a
└── pid
$ mole -stop 10df414a
$ tree $HOME/.mole
tree ~/.mole
$HOME/.mole
└── instances
I wouldn't care about handling output redirection right now. The user can always use >
, >>
, etc. to achieve that.
from mole.
Another good resource about support for daemonize in Go: golang/go#227
from mole.
Can i take this ?
Do i have to implement flag to stop daemon process ?
from mole.
Can i take this ?
Do i have to implement flag to stop daemon process ?
Sure! Thanks for considering contributing to the project, @tidjungs.
Having a command (-stop
?) to stop a detached mole instance seems to be a good idea.
Let's assume we will have a flag name -detach
to indicate the app should run in background mode and another one, -stop
, to stop the app that is already running in background mole.
The latter flag would required an application identifier to be able to stop it, which would be relatively easy to identify if the user had started the app with -start
, but I am unsure how to approach the other cases where there is no clear identifier.
One could propose that pid
could be provided, but if the app required the user to fetch the pid
from the list of processes, then the user could just use kill
or something like that.
$ mole -start example1 -detach
INFO[0000] listening on local address local_address="127.0.0.1:52218"
$ mole -stop example1
$ mole -detach -remote :3306 -server my-server
INFO[0000] listening on local address local_address="127.0.0.1:52219"
$ mole -stop ???
from mole.
what about
$mole -detach -remote :3306 -server my-server
daemon is running on <alias_name> (maybe name generate with random hex)
stop daemon: $mole -stop <alias_name>
and Alias case
$mole -start example1 -detach
$mole -stop example1
What do you think ?
And I have no idea how to manage structure of pid, log file
what you think about -log=/path/to/log and default is "./"
inside have
pid_alias_name
log_alias_name
from mole.
ok I got it
from mole.
PR #35
from mole.
Related Issues (20)
- Question on Usage: Define source as a non-existent hostname/domain name HOT 1
- logon using privatekey denied. error ssh: handshake failed: knownhosts: key is unknown HOT 1
- error runtime: bad pointer in frame github.com/konsorten/go-windows-terminal-sequences HOT 1
- Fix `add alias` help
- request for ENHANCEMENT: [github] xanzy/ssh-agent and/or passphrases for private keys ... HOT 3
- Feature request: unix socket forwarding
- Key mismatch HOT 8
- Missing `config` attribute on `<alias>.toml` file causing application to fail HOT 2
- New feature: SOCKS support
- ProxyCommand parameter in config not used, cannot use ssh proxy jump host HOT 1
- Can't get running configuration of detached instance HOT 1
- [Feature Request] Support aarch64 architecture for Raspberry Pi HOT 1
- [Feature Request] Support Remote Forwarding HOT 1
- [Feature Request] alias for remote port forwarding HOT 1
- Find another way to find is key is encrypted
- --detach not working HOT 8
- Mole not support ssh Include configuration files
- Show instances is not returning anything
- How to
- Ignoring IdentityAgent from SSH config and -A CLI option
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mole.