Last active
August 29, 2015 14:24
-
-
Save kakwa/23eef5f44017be15b4f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
notkill(){ printf "killing process: $1\n";tmpdir=`mktemp -d`;[ $? -eq 0 ] || return 1;printf "#include <sys/types.h>\n#include <signal.h>\n#include <stdlib.h>\nint main(int argc, char * argv[]){\nif (argc <= 1)\nreturn 1;\nint pid = atoi(argv[1]);\nint ret = kill(pid, SIGTERM);\nreturn ret;\n}" > $tmpdir/file.c; gcc $tmpdir/file.c -o $tmpdir/notkill;$tmpdir/notkill $1;ret=$?;! [ -z "$tmpdir" ] && [ -d "$tmpdir" ] && rm -rf $tmpdir;return $ret; }; notkill <YOUR PID> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ugly one liner to kill a process