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

Implement -U. #2049

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Implement -U. #2049

wants to merge 3 commits into from

Conversation

g0mb4
Copy link

@g0mb4 g0mb4 commented Oct 2, 2024

If this argument is provided Conky won't start if another Conky process is already running.

Conky starts multiple times on my system at startup, and it is bothering me. I'm too lazy to check all of my config files, so I added this mechanism to prevent this behavior.

If this argument is provided Conky won't start if another Conky process
is already running.
@github-actions github-actions bot added documentation Issue or PR that suggests documentation improvements sources PR modifies project sources labels Oct 2, 2024
Copy link

netlify bot commented Oct 2, 2024

Deploy Preview for conkyweb canceled.

Name Link
🔨 Latest commit 03df49f
🔍 Latest deploy log https://app.netlify.com/sites/conkyweb/deploys/66fe75acff999d0008340016

@brndnmtthws
Copy link
Owner

A couple issues: /proc is generally Linux-only (see https://en.wikipedia.org/wiki/Procfs), so we can't assume it's there on BSDs and macOS.

Another problem, getting the process name from /proc/[pid]/cmdline isn't a great idea because the command could have a symlink or some other strangeness. Better to use either /proc/[pid]/stat or follow the /proc[pid]/exe symlink.

@g0mb4
Copy link
Author

g0mb4 commented Oct 2, 2024

Thanks! It's the typical case of "it works on my machine"...
I'll try to figure out a POSIX solution (maybe using ps).

The previous method used `/proc` to check the running processes,
but it is a Linux-specific solution.

This method uses `ps`, hopefully in a POSIX-compliant way.

Linux: https://man7.org/linux/man-pages/man1/ps.1.html
FreeBSD: https://man.freebsd.org/cgi/man.cgi?ps(1)
OpenBSD: https://man.openbsd.org/ps.1
A random process named `conky11` won't stop Conky to start when
`-U` is provided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Issue or PR that suggests documentation improvements sources PR modifies project sources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants