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?

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?

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.

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).
JJonas (30th November 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?

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)
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

killall -s QUIT gimp
thats working for me
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 <jobnum>" 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.
There are currently 1 users browsing this thread. (0 members and 1 guests)