microservices icon indicating copy to clipboard operation
microservices copied to clipboard

Error running make install for the first time

Open gonrial opened this issue 10 years ago • 4 comments

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 avatar Dec 02 '15 23:12 gonrial

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

umermansoor avatar Dec 03 '15 04:12 umermansoor

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

gonrial avatar Dec 06 '15 20:12 gonrial

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.

HaveF avatar Dec 12 '15 04:12 HaveF

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

george-vieira avatar Dec 04 '16 00:12 george-vieira