+ Post New Thread
Results 1 to 9 of 9
*nix Thread, Ubuntu:Shut down application at a set time in Technical; Ive used scheduled tasks to start an application at a set time(in this case gimp), what would I need to ...
  1. #1

    JJonas's Avatar
    Join Date
    Jan 2008
    Location
    North Walsham, Norfolk
    Posts
    3,114
    Thank Post
    388
    Thanked 437 Times in 325 Posts
    Rep Power
    384

    Ubuntu:Shut down application at a 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?

  2. #2

    JJonas's Avatar
    Join Date
    Jan 2008
    Location
    North Walsham, Norfolk
    Posts
    3,114
    Thank Post
    388
    Thanked 437 Times in 325 Posts
    Rep Power
    384
    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.

  3. #3

    powdarrmonkey's Avatar
    Join Date
    Feb 2008
    Location
    Alcester, Warwickshire
    Posts
    4,859
    Thank Post
    412
    Thanked 777 Times in 650 Posts
    Rep Power
    182
    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).

  4. Thanks to powdarrmonkey from:

    JJonas (30th November 2009)

  5. #4

    JJonas's Avatar
    Join Date
    Jan 2008
    Location
    North Walsham, Norfolk
    Posts
    3,114
    Thank Post
    388
    Thanked 437 Times in 325 Posts
    Rep Power
    384
    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?

  6. #5


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    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)

  7. #6
    TwoZeroAlpha's Avatar
    Join Date
    Nov 2008
    Location
    Colchester, Essex
    Posts
    474
    Thank Post
    69
    Thanked 68 Times in 54 Posts
    Rep Power
    35
    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

  8. #7

    JJonas's Avatar
    Join Date
    Jan 2008
    Location
    North Walsham, Norfolk
    Posts
    3,114
    Thank Post
    388
    Thanked 437 Times in 325 Posts
    Rep Power
    384
    killall -s QUIT gimp


    thats working for me

  9. #8
    llawwehttam's Avatar
    Join Date
    Nov 2008
    Location
    Birmingham
    Posts
    223
    Thank Post
    56
    Thanked 3 Times in 3 Posts
    Blog Entries
    2
    Rep Power
    14
    Quote Originally Posted by TwoZeroAlpha View Post

    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.

  10. #9

    Join Date
    Nov 2008
    Posts
    41
    Thank Post
    8
    Thanked 1 Time in 1 Post
    Rep Power
    0
    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.

SHARE:
+ Post New Thread

Similar Threads

  1. net time set
    By chrbb in forum Wireless Networks
    Replies: 3
    Last Post: 21st May 2009, 08:36 AM
  2. time restrictions web-application
    By browolf in forum Windows
    Replies: 6
    Last Post: 28th April 2008, 04:32 PM
  3. Ubuntu Server FQ Domain name not set
    By mark in forum *nix
    Replies: 6
    Last Post: 26th July 2007, 11:35 AM
  4. auto lock computer after set time
    By timbo343 in forum Windows
    Replies: 13
    Last Post: 30th March 2007, 07:54 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •