pid

Wait for all processes with a certain name to finish (in bash)

 ̄綄美尐妖づ 提交于 2019-12-05 19:18:46
I would like to wait in linux (Ubuntu 11.10) for a load of processes to finish. Each of these processes has a different pid but the same name. Is it possible to do this? EDIT: Perhaps I should specify that I don't necessarily know what the pid are, just the process name. EDIT: Thanks for the answers; Kevin's seems to do what I want. However, it doesn't work in the specific application I have, so I've posted a more detailed follow-up question here . wait $(pgrep programName) Ought to do it. wait $(pidof processname) perhaps. As long as you have the pid of these processes: wait $pid_of_process

How to get PID via subprocess.Popen with custom environment variable?

感情迁移 提交于 2019-12-05 18:55:37
Using Python, how can I run a subprocess with a modified environment variable and get its PID? I assume subprocess.Popen() is along the right track... In shell (bash), I would do this: MY_ENV_VAR=value ./program_name arg1 arg2 etc & This runs program_name in the background, passing in "arg1" and "arg2" and "etc", with a modified environment variable, "MY_ENV_VAR" with a value of "value". The program program_name requires the environment variable MY_ENV_VAR to be set to the proper value. How can do the equivalent thing in Python? I absolutely need the PID of the process. (My intent is to keep

how to iterate over PCB's to show information in a Linux Kernel Module?

回眸只為那壹抹淺笑 提交于 2019-12-05 18:03:45
I want to write a little Linux Kernel Module that can show me the PID of all running processes. I have the following code: /* * procInfo.c My Kernel Module for process info */ #include <linux/init.h> #include <linux/module.h> #include <linux/kernel.h> /* * The init function, called when the module is loaded. * Returns zero if successfully loaded, nonzero otherwise. */ static int mod_init(void) { printk(KERN_ALERT "ProcInfo sucessfully loaded.\n"); return 0; } /* * The exit function, called when the module is removed. */ static void mod_exit(void) { printk(KERN_ALERT "ProcInfo sucessfully

yii的多表查询

假如想象 提交于 2019-12-05 17:29:49
获取用户发布消息的指定消息id的总和点赞数 Yii $productIds = ['2260', '2262', '2263', '2268', '2269']; $plSql = Like::find()->where([ 'pId' => $pIds, 'isLike' => 1 ])->select('pId,count(id) c') ->groupBy('pId')->createCommand()->getRawSql(); $messages = Message::find() ->innerJoin("({$plSql} ) as pl", "msg.id = pl.pId") ->alias('msg')->groupBy('msg.customerId') ->select('msg.customerId,SUM(pl.c) as s') ->createCommand()->getRawSql(); MySQL SELECT `msg`.`customerId`, SUM(pl.c) AS s FROM `message` `msg` INNER JOIN ( SELECT `pId`, count(id) c FROM `like` WHERE ( `pId` IN ( '2260', '2262', '2263', '2268', '2269' ) )

Can you inject code/an exe into a process with python?

青春壹個敷衍的年華 提交于 2019-12-05 12:35:12
I've seen a few sites talking about injecting DLL's (such as http://www.codeproject.com/KB/DLL/DLL_Injection_tutorial.aspx ), but I'm struggling with how to get an EXE to work. any help/tips would be appreciated. The best way I know how to explain it is "RunPE" where you execute an exe in the memory. Does that help at all? If you're asking how to inject code into a running Python process, what you want is https://fedorahosted.org/pyrasite/ . You can use the Reflective DLL Injector as described here. Metasploit project uses it to load its meterpreter plug-ins. AFAIK this is the only way to

how to stop rabbitmq servers

我的梦境 提交于 2019-12-05 11:20:58
I am trying to start a node app and I think rabbitmq is getting in the way. Similar to this thread: "node with name "rabbit" already running", but also "unable to connect to node 'rabbit'" $ ps aux | grep erl rabbitmq 1327 0.0 0.0 2376 300 ? S Dec13 0:00 /usr/lib/erlang/erts-5.8.5/bin/epmd -daemon rabbitmq 1344 0.0 0.3 59560 14888 ? Sl Dec13 0:10 /usr/lib/erlang/erts-5.8.5/bin/beam.smp -W w -K true -A30 -P 1048576 -- -root /usr/lib/erlang -progname erl -- -home /var/lib/rabbitmq -- -noshell -noinput -sname rabbit@jasonshark -boot /var/lib/rabbitmq/mnesia/rabbit@jasonshark-plugins-expand/rabbit

Get the logon session of a user in C++

无人久伴 提交于 2019-12-05 11:06:38
问题 I want to get a handle on the current logon session of processes whose parent is explorer.exe. If we run a process as administrator or a service it won't have a logon session. The reason I want to get the logon session is that I have a program (.exe) which I want to restrict opening when a user tries to open it via (right click on the .exe--> run as administrator) and when a user opens it via administrator we don't have a logon session associated with it whereas when a user opens it by double

How to get the PID from a ProcessSerialNum in OSX 10.9?

和自甴很熟 提交于 2019-12-05 10:48:31
GetProcessPID was marked deprecated in OSX 10.9 along with the note: Use the processIdentifier property of the appropriate NSRunningApplication object. The problem is the constructing class methods for NSRunningApplication do not have a way to get a NSRunningApplication by a ProcessSerialNum , only by PID or bundle name. Bundle name is too ambiguous (there could be multiple instances) and I don't have the PID (it's what I want). In OSX 10.9, is there a way to get the PID when you have a PSN? Observe the NSWorkspaceDidLaunchApplicationNotification notification. In the callback, get the process

How can I get process name of specific PID with ps command in alpine

会有一股神秘感。 提交于 2019-12-05 09:19:45
In ubuntu based docker/os $ ps PID USER TIME COMMAND 1 postgres 0:00 postgres 47 postgres 0:00 postgres: checkpointer process 48 postgres 0:00 postgres: writer process 49 postgres 0:00 postgres: wal writer process 50 postgres 0:00 postgres: autovacuum launcher process 51 postgres 0:00 postgres: stats collector process 52 postgres 0:00 postgres: bgworker: logical replication launcher Now If run ps -p 1 -o user= , it will get me PID 1 process USER postgres $ ps -p 1 -o user= postgres This is what I can do in ubuntu based image/os Now I am really seeking for a way to do the same for alpine based

python 获取进程id并杀死进程

前提是你 提交于 2019-12-05 09:06:28
语言:python3   系统:ubuntu18   只能在Unix系统运行 import os import re import signal # 要杀死程序名称,最好全名 program_name = "chromedriver" # 终端执行的命令 order_str = "ps x | grep %s" % program_name # 执行 strs_obj = os.popen("ps x | grep chromedriver") t_strs = strs_obj.read() # 通过正则获取pid pid_list = re.findall(r"(\d+).+chromedriver --port=\d+", t_strs, re.I) print(pid_list) for j in pid_list: print(j) # 杀死进程 os.kill(int(j), signal.SIGKILL) 来源: https://www.cnblogs.com/xianqingsong/p/11918060.html