JJonas Posted November 30, 2009 Posted November 30, 2009 Ive used scheduled tasks to start an application at a set time(in this case gimp), what would I need to do to automatically shut down an application at another set time?
JJonas Posted November 30, 2009 Author Posted November 30, 2009 I guess what im after is a command line to close a running application. I am aware of kill but that is probably not the way to do it.
powdarrmonkey Posted November 30, 2009 Posted November 30, 2009 Kill is the way to go; you can pass it a parameter to say how gentle you want it to be (man kill, look at the signals section). 1
JJonas Posted November 30, 2009 Author Posted November 30, 2009 so I guess I do kill stop process-id I know I can find the process-id for my running application under system monitor..processes but the process-id is going to change each time I run an application. How could I use kill to automatically close an app for example gimp without looking up its process-id first?
CyberNerd Posted November 30, 2009 Posted November 30, 2009 you can use the killall command, and don't need to lookup PID's How to use the killall command -- by The Linux Information Project (LINFO) 1
TwoZeroAlpha Posted November 30, 2009 Posted November 30, 2009 I find pkill useful for stopping non-responsive programs. Guess you're not bothered about saving if the'yre shutting down anyhow, How about "pkill -9 gimp" You might need to pass it as a sudo command though. Tested here and it worked, Gimp just closed. No loss in system stability. If you want to check the process name try ps -u username
JJonas Posted November 30, 2009 Author Posted November 30, 2009 killall -s QUIT gimp thats working for me
llawwehttam Posted December 7, 2009 Posted December 7, 2009 How about "pkill -9 gimp" You might need to pass it as a sudo command though. You won't have to pass it throught sudo as long as the process your killing is running as the same username as the script.
m0nty Posted December 8, 2009 Posted December 8, 2009 Use killall and the "at" daemon. As root, ensure that atd is running ("ps ax | grep atd"). Then you can type something like: at 23:17 You'll get a > prompt (iirc). You can type as many commands as you like here, pressing return at the end of each one. I tend to prepare these in advance and cut/paste since I find the backspace and arrow keys don't work well at the "at" prompt. killall -9 someprogram Press return. You could also do something like poweroff to shut down the whole PC at that time. Press Ctrl-D to get to your usual prompt. Type "atq" to see the list of at jobs waiting to be run, and "atrm " to get rid of any you don't want. HTH -- Simon BTW: I am a bad person and tend to be logged in as root. Whether or not you run your "at" commands as yourself or the root user depends on the amount of damage you're prepared to risk, but for me it's never been an issue.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now