kill

kill users processes in linux with php

别说谁变了你拦得住时间么 提交于 2020-01-11 13:35:09
问题 I am trying to write a php script to kill users in a redhat machine. I know it is possible (and very insecure) to give apache the ability to do things as root, but I need to be able to kill any user from a web page, does anyone have any good working scripts or point me to a place to find some more info? I can use this code (which I took from php.net) to make it work, but I assume that this will work only if I give apache root permission or run apache as root. <?php exec("kill -9 $pid"); ?>

How to execute a handler function before quit the program when receiving kill signal from“killall” or “kill -p pid”?

核能气质少年 提交于 2020-01-11 12:35:21
问题 I have the following code: #include <stdio.h> #include <stdlib.h> #include <pthread.h> pthread_t test_thread; void *thread_test_run (void *v) { int i=1; while(1) { printf("into thread %d\r\n",i); i++; sleep(1); } return NULL } int main() { pthread_create(&test_thread, NULL, &thread_test_run, NULL); sleep (20); pthread_cancel(test_thread); sleep(100); // In this period (before the finish of myprogram), // I execute killall to kill myprogram // I want to add a signal handle function to //

How to save/restore global variables in android even when os kill application

泪湿孤枕 提交于 2020-01-10 19:40:38
问题 In android,Google recommends us to save the global variables in Application. But there is a problem, if the android os kill the application because of low of memory, the application will be re-oncreate and the global variables I saved will be lost. I don't know when to save/restore these variables,application doesn't give us some methods such as onsaveinstancestate()/onrestoreinstancestate(). I have one idea but I can't make sure it can work well. I see some app will go to slashScreen when os

C# Windows Form Killed By Task Manager…Is There a Way to Run Shutdown Function?

别说谁变了你拦得住时间么 提交于 2020-01-10 05:50:11
问题 I doubt this is even possible. So your app is running and user decides to End Process via Task Manager. Is there a method/action to save data during process.kill? I doubt there is but I had to ask. Also, if a user shuts down/restarts PC (as in windows update/manual restart), what action would the app execute? Window_Unloaded? On this second question, I would like to find a way to ensure my app does not show up as a 'if you want to restart, kill this app' situation and want to save needed data

【转】linux下杀死进程(kill)的N种方法

假如想象 提交于 2020-01-07 05:39:36
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 【转】linux下杀死进程(kill)的N种方法 转载一篇,最原始的出处已不可考,望见谅! 常规篇:  首先,用ps查看进程,方法如下: $ ps -ef …… smx 1822 1 0 11:38 ? 00:00:49 gnome-terminal smx 1823 1822 0 11:38 ? 00:00:00 gnome-pty-helper smx 1824 1822 0 11:38 pts/0 00:00:02 bash smx 1827 1 4 11:38 ? 00:26:28 /usr/lib/firefox-3.6.18/firefox-bin smx 1857 1822 0 11:38 pts/1 00:00:00 bash smx 1880 1619 0 11:38 ? 00:00:00 update-notifier …… smx 11946 1824 0 21:41 pts/0 00:00:00 ps -ef 或者: $ ps -aux …… smx 1822 0.1 0.8 58484 18152 ? Sl 11:38 0:49 gnome-terminal smx 1823 0.0 0.0 1988 712 ? S 11:38 0:00 gnome-pty-helper smx

linux下杀死进程(kill)的N种方法

一曲冷凌霜 提交于 2020-01-07 05:37:58
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 常规篇 :  首先,用ps查看进程,方法如下: $ ps -ef …… smx 1822 1 0 11:38 ? 00:00:49 gnome-terminal smx 1823 1822 0 11:38 ? 00:00:00 gnome-pty-helper smx 1824 1822 0 11:38 pts/0 00:00:02 bash smx 1827 1 4 11:38 ? 00:26:28 /usr/lib/firefox-3.6.18/firefox-bin smx 1857 1822 0 11:38 pts/1 00:00:00 bash smx 1880 1619 0 11:38 ? 00:00:00 update-notifier …… smx 11946 1824 0 21:41 pts/0 00:00:00 ps -ef 或者: $ ps -aux …… smx 1822 0.1 0.8 58484 18152 ? Sl 11:38 0:49 gnome-terminal smx 1823 0.0 0.0 1988 712 ? S 11:38 0:00 gnome-pty-helper smx 1824 0.0 0.1 6820 3776 pts/0 Ss 11:38 0:02 bash

Kill other process in Android

余生颓废 提交于 2020-01-06 20:37:42
问题 Can I end or kill other process running, programmatically? I'm asked my friend and tell me should using something like kiosk mode !! Could anyone help me to solve this problem .. All regards and thanks. 回答1: Recently I was investigating the same question, because I got tired of manually having to close the Google Maps application that regularly automatically opens and keeps running in the background and draining my battery... But I don't think that Android lets you kill any processes but your

using python subprocess.call to kill all running python files

萝らか妹 提交于 2020-01-06 09:32:58
问题 I'm trying to kill (on a demand) all the python processes that are running at the moment. I was using this command: from subprocess import call call('pkill python', shell=True) print 'Killed them all!' But, of course - my program is also a python program, so eventually, it doesn't reach the print line after calling 'call'. What can I do in order to avoid my program to kill also itself, while killing all other python processes? Thanks. 回答1: You may want to try cross-platform psutil library:

Killing a Windows process from a C# console application: how do I set permissions?

拥有回忆 提交于 2020-01-06 01:55:29
问题 Using Process.Kill() from an ASP.NET web application, I get a Win32Exception with text "Access is denied". Searching the web has several times told me to set permissions. However I don't really understand the Windows XP User system well enough to know how to get started. At the time the exception is thrown, Thread.CurrentPrincipal.Identity has the following visible properties: AuthenticationType = "" IsAuthenticated = "false" Name = "" WindowsIdentity.GetCurrent() shows me logged in as "NAME

pthread kill after a certain time duration

跟風遠走 提交于 2020-01-05 19:28:10
问题 I'm working with VS2005 C++ and I'm BRAND NEW to it. I have a loop that creates several threads using the following statement - rc = pthread_create(&thread[i], NULL, &Function, (void *)threadID); I want to terminate all threads after a certain duration (say 5 minutes). How do I have a timer that kills all threads after this duration? 回答1: I believe, something like that: pthread_t tid[thread_num] = {}; for(size_t i = 0 ; i < threads_num; ++i){ pthread_create(&tid[i], NULL, func, arg); } sleep