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

Error running make install for the first time #1

Open
gonrial opened this issue Dec 2, 2015 · 4 comments
Open

Error running make install for the first time #1

gonrial opened this issue Dec 2, 2015 · 4 comments

Comments

@gonrial
Copy link

gonrial commented Dec 2, 2015

Under Ubuntu, this is the error I got.

ps -ef | grep "services/movies.py" | grep -v grep | awk '{print $2}' | xargs kill  

Usage:
 kill [options] <pid> [...]

Options:
 <pid> [...]            send signal to every <pid> listed
 -<signal>, -s, --signal <signal>
                        specify the <signal> to be sent
 -l, --list=[<signal>]  list all signal names, or convert one to a name
 -L, --table            list all signal names in a nice table

 -h, --help     display this help and exit
 -V, --version  output version information and exit

For more details see kill(1).
make: *** [shutdown] Error 123

The problem is related to the kill part, as this is my first time, there is no PID and therefore, kill complains.

Fixed by adding -r to the xargs. According to the man page: Do not run the command if there are no arguments. Normally the command is executed at least once even if there are no arguments.

@gonrial gonrial changed the title Error running mkae install for the first time Error running make install for the first time Dec 2, 2015
@umermansoor
Copy link
Owner

Thanks for pointing this out. Unfortunately, -r switch is only available in the GNU variants and won't run on BSD based implementations like OSX.

Here's what I get on my mac when I try to execute the command:

ps -ef | grep "services/movies.py" | grep -v grep | awk '{print $2}' | xargs -r kill
xargs: illegal option -- r
usage: xargs [-0opt] [-E eofstr] [-I replstr [-R replacements]] [-J replstr]
             [-L number] [-n number [-x]] [-P maxprocs] [-s size]
             [utility [argument ...]]
make: *** [shutdown] Error 1

Links you might be interested in as you try to find a solution:
http://stackoverflow.com/questions/17402345/ignore-empty-results-for-xargs-in-mac-os-x
http://stackoverflow.com/questions/18812766/dont-call-xargs-if-the-previous-command-doesnt-return-anything

@gonrial
Copy link
Author

gonrial commented Dec 6, 2015

Found the same thing in oh-my-zsh, I think this is a cleaner way.
Can you check this patch now works in OSX?

@HaveF
Copy link

HaveF commented Dec 12, 2015

Here is my windows info, I append -f to fix this, but it seems no such option in other platform.

/d/src/microservices {develop} $ make install
ps -ef | grep "services/movies.py" | grep -v grep | awk '{print $2}' | xargs kill
Usage: kill [-f] [-signal] [-s signal] pid1 [pid2 ...]
       kill -l [signal]

Send signals to processes

 -f, --force     force, using win32 interface if necessary
 -l, --list      print a list of signal names
 -s, --signal    send signal (use kill --list for a list)
 -h, --help      output usage information and exit
 -V, --version   output version information and exit

make: *** [shutdown] Error 123

after I change command like this: ps -ef | grep "services/movies.py" | grep -v grep | awk '{print $2}' | xargs kill -f, this target works.

@george-vieira
Copy link

append this to the xargs command within the "makefile" file to fix it.
--no-run-if-empty

result lines:
shutdown:
ps -ef | grep "services/movies.py" | grep -v grep | awk '{print $$2}' | xargs --no-run-if-empty kill
ps -ef | grep "services/showtimes.py" | grep -v grep | awk '{print $$2}' | xargs --no-run-if-empty kill
ps -ef | grep "services/bookings.py" | grep -v grep | awk '{print $$2}' | xargs --no-run-if-empty kill
ps -ef | grep "services/user.py" | grep -v grep | awk '{print $$2}' | xargs --no-run-if-empty kill

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

4 participants