Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check if another instance of ZPUI is running #120

Open
piajesse opened this issue Oct 19, 2018 · 10 comments
Open

Check if another instance of ZPUI is running #120

piajesse opened this issue Oct 19, 2018 · 10 comments
Labels
developer-friendliness Anything that helps people working on apps enhancement

Comments

@piajesse
Copy link

piajesse commented Oct 19, 2018

How

At start up, check if there there is a PID file at /tmp/zpui.pid, and if there is check if the number inside the files PID is still running, if it is, then fail to start if no console, and if there is a console say another instance is still running and ask if they want to quit or try again. and if its running, say a warning and then overwrite with that processes PID is still there and that most likely means a failed shutdown, and then start like normal

@CRImier CRImier added enhancement developer-friendliness Anything that helps people working on apps labels Oct 19, 2018
@CRImier
Copy link
Member

CRImier commented Oct 19, 2018

We do have a pidfile already, too: PIDFile=/run/zpui.pid (from the .service file) However, it obviously isn't used when we run ZPUI as sudo python main.py.

@piajesse
Copy link
Author

could we add that to avoid someone trying to run 2 instances at the same time?

@CRImier
Copy link
Member

CRImier commented Oct 19, 2018

Sure, that's doable - no idea how exactly yet, but sure, why not. I'd suggest a warning more than "refuse to start", I'd rather not make this into something that developers would have to fight in case of a bug with detection mechanism

@piajesse
Copy link
Author

I meant for it to pause at start asking if you wanted to continue anyways, try to top the other PID, or just close
We could also add a starting argument like --ignore-pid to avoid this check :D

@CRImier
Copy link
Member

CRImier commented Oct 19, 2018

not sure about an argument - don't want anyone to run "main.py --help" to figure out a bug. A pause on start sounds more dev-friendly =)

@piajesse
Copy link
Author

so I see the line that says to use /run/zpui.pid in /etc/systemd/system/zpui.service but when it start the ui via systemctl start zpui it start up and works and doesn't create a pid file in said location...

@CRImier
Copy link
Member

CRImier commented Oct 19, 2018

hmm. Could you debug the service file?

@CRImier
Copy link
Member

CRImier commented Oct 19, 2018

As in, how to force systemd to create it

@piajesse
Copy link
Author

Actually I will set it up that when it checks It will just create a file if it doesn't exist, and if it does exist and its the same pid as the current running version, it will just continue

@CRImier
Copy link
Member

CRImier commented Oct 19, 2018

hmm, sounds like a good workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer-friendliness Anything that helps people working on apps enhancement
Projects
None yet
Development

No branches or pull requests

2 participants