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

Kill megacron with the megacrond command #51

Open
greg-github opened this issue Apr 9, 2014 · 10 comments
Open

Kill megacron with the megacrond command #51

greg-github opened this issue Apr 9, 2014 · 10 comments

Comments

@greg-github
Copy link
Collaborator

There should be a graceful way to kill megacron, as illustrated by John's issue with getting rid of the daemon.

@greg-github
Copy link
Collaborator Author

Proposal: (I'm going to take at implementing this within the next few days) kill with megacrond -k, edit main.py to take the -k command, and upon that we run read_pid_from_pidfile(/var/run/megacron.pid), then use os.kill(pid,SIGINT).

@johntanner
Copy link
Collaborator

Sounds good! I don't know if SIGINT on a single pid will take care of all of the instances (which may be desirable), but do some experimentation!

@umzegher
Copy link
Collaborator

umzegher commented Apr 9, 2014

I am unable to reproduce this issue. Why doesn't "killall megacrond" work?

@johntanner
Copy link
Collaborator

I received the message johns-mbp:megacron johntanner$ sudo killall
megacrond No matching processes were found, also without sudo.

On Wed, Apr 9, 2014 at 7:23 AM, Ben Zeghers [email protected]:

I am unable to reproduce this issue. Why doesn't "killall megacrond" work?

Reply to this email directly or view it on GitHubhttps://github.com//issues/51#issuecomment-39969499
.

@umzegher
Copy link
Collaborator

umzegher commented Apr 9, 2014

What are the steps to reproduce this issue? If the name of the process
doesn't contain megacrond, then what is it?
On Apr 9, 2014 11:39 AM, "John Tanner" [email protected] wrote:

I received the message johns-mbp:megacron johntanner$ sudo killall
megacrond No matching processes were found, also without sudo.

On Wed, Apr 9, 2014 at 7:23 AM, Ben Zeghers <[email protected]

wrote:

I am unable to reproduce this issue. Why doesn't "killall megacrond"
work?

Reply to this email directly or view it on GitHub<
https://github.com/BigFav/MegaCron/issues/51#issuecomment-39969499>
.

Reply to this email directly or view it on GitHubhttps://github.com//issues/51#issuecomment-39986480
.

@johntanner
Copy link
Collaborator

Steps are:

  1. sudo megacrontab -e ... enter a crontab ie. * * * * * echo hello >
    /Users/johntanner/Desktop/hello.txt ... save
  2. sudo megacrond
  3. sudo megacron-status ... observe that 1 worker is up
  4. killall megacrond ... No matching processes belonging to you were found
  5. sudo killall megacrond ... No matching processes were found
  6. Observe how the job still runs every minute.
  7. ps aux | grep megacron
    root 93340 0.1 0.0 2467248 1632 ?? S 10:03am
    0:00.40
    /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
    /usr/local/bin/megacrond
    root 92164 0.0 0.1 2468276 4340 ?? S 11:08pm
    0:03.64
    /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
    /usr/local/bin/megacrond
    johntanner 93393 0.0 0.0 2423368 184 s001 R+ 10:07am
    0:00.00 grep megacron

NOTE The process belonging to johntanner is probably from an earlier,
unkilled trial.

On Wed, Apr 9, 2014 at 9:59 AM, Ben Zeghers [email protected]:

What are the steps to reproduce this issue? If the name of the process
doesn't contain megacrond, then what is it?

On Apr 9, 2014 11:39 AM, "John Tanner" [email protected] wrote:

I received the message johns-mbp:megacron johntanner$ sudo killall
megacrond No matching processes were found, also without sudo.

On Wed, Apr 9, 2014 at 7:23 AM, Ben Zeghers <[email protected]

wrote:

I am unable to reproduce this issue. Why doesn't "killall megacrond"
work?

Reply to this email directly or view it on GitHub<
https://github.com/BigFav/MegaCron/issues/51#issuecomment-39969499>
.

Reply to this email directly or view it on GitHub<
https://github.com/BigFav/MegaCron/issues/51#issuecomment-39986480>

.

Reply to this email directly or view it on GitHubhttps://github.com//issues/51#issuecomment-39988781
.

@umzegher
Copy link
Collaborator

umzegher commented Apr 9, 2014

This issue doesn't happen on megacron-one.wmflabs.org. It must be specific to OS X or your system. Does "sudo pkill -f megacrond" work for you?

@johntanner
Copy link
Collaborator

That works. I am on Mac OS X Mavericks 10.9.2

On Wed, Apr 9, 2014 at 10:52 AM, Ben Zeghers [email protected]:

This issue doesn't happen on megacron-one.wmflabs.org. It must be
specific to OS X or your system. Does "sudo pkill -f megacrond" work for
you?

Reply to this email directly or view it on GitHubhttps://github.com//issues/51#issuecomment-39995130
.

@johntanner
Copy link
Collaborator

I still think we should have a unified command for stopping the daemon. Is
Greg's suggestion not good?

On Wed, Apr 9, 2014 at 11:00 AM, John Tanner [email protected] wrote:

That works. I am on Mac OS X Mavericks 10.9.2

On Wed, Apr 9, 2014 at 10:52 AM, Ben Zeghers [email protected]:

This issue doesn't happen on megacron-one.wmflabs.org. It must be
specific to OS X or your system. Does "sudo pkill -f megacrond" work for
you?

Reply to this email directly or view it on GitHubhttps://github.com//issues/51#issuecomment-39995130
.

@umzegher
Copy link
Collaborator

umzegher commented Apr 9, 2014

It seems that killall and pkill only match the process name by default on OS X. Since our daemon is running though the Python interpreter the process name is python and megacrond is in the arguments. On Linux it will match the process name or the arguments and the -f flag for pkill will do this on OS X too. I just wanted to know what was causing this issue and why it was only happening sometimes before we decide how to solve it. Given what we now know if you still think that this is the best solution, then go ahead and implement it.

As John mentioned before there is an issue with my daemon implementation that multiple can be run at a time. When multiple start they overwrite the PID file which isn't good. The library seems to have code that throws an error if the file already exists but it will have to be investigated why this isn't working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants