Any application that can act as a "sleep timer" (kill other apps at given time)

Discussion in 'Archived Threads 2001-2004' started by Vince Maskeeper, Nov 11, 2002.

  1. Vince Maskeeper

    Vince Maskeeper Producer

    Joined:
    Jan 18, 1999
    Messages:
    6,499
    Likes Received:
    0
    Looking for a way to kill an app after set amount of time, or at a certain time of day. I can get Task Scheduler to launch stuff, but not end a task.

    Any thoughts?

    -Vince
     
  2. Patrick Larkin

    Patrick Larkin Screenwriter

    Joined:
    May 8, 2001
    Messages:
    1,759
    Likes Received:
    0
    in Mac OS X (and Unix) you can somply set a cron job to execute anything you want at any time and at any interval.

    i don't know if windows has such a thing.
     
  3. Wayne Bundrick

    Wayne Bundrick Cinematographer

    Joined:
    May 17, 1999
    Messages:
    2,358
    Likes Received:
    0
    In Windows XP (probably 2000 also) you can use the "at" command line scheduler to issue a taskkill command at a given time.
     
  4. John_Berger

    John_Berger Cinematographer

    Joined:
    Nov 1, 2001
    Messages:
    2,489
    Likes Received:
    0
    Yes, the at command is available in Windows 2000 as well.
     
  5. Vince Maskeeper

    Vince Maskeeper Producer

    Joined:
    Jan 18, 1999
    Messages:
    6,499
    Likes Received:
    0
    Can you guys post additional info on using this- or a link if you don't have time? I looked into it a little- and I played with it and got it to delete files at give times... I can find it and run it in 2000 but don't know what the NT command line to kill an app would be...

    Will this only work with tasks that were started using scheduler- or can I ask it to kill something I started?

    -Vince
     
  6. John_Berger

    John_Berger Cinematographer

    Joined:
    Nov 1, 2001
    Messages:
    2,489
    Likes Received:
    0
    Vince,
    According to Microsloth's support page (click here), you need the Windows Resource Kit to kill processes from the command line under Windows NT and Windows 2000. (This is based on their statement in the Resolution section. The entire KB article is not really relevant, but I saw the Resource Kit reference.) If that's not installed, I'm not sure what options are available to you.
     
  7. Patrick Larkin

    Patrick Larkin Screenwriter

    Joined:
    May 8, 2001
    Messages:
    1,759
    Likes Received:
    0
    i only know unix but i believe the 'at' system will execute something once. 'cron' can execute things on a recurring basis - down to seconds.

    to quit an app in unix, one can use the 'kill' command with a process id. each running app is given a unique process id so by issuing a 'ps ax' command, you are given a list of running processes. there, you can see the process number and issue the kill command such as 'kill 32456' Of course, this only works for a manual kill. If you want cron to scan for a process and kill it if its running, unattended, you'd have to create a script and have cron execute it at certain times.

    If Windows has the at commands, then it should have cron. I suppose there is some sort of command line process viewer as well...
     
  8. John_Berger

    John_Berger Cinematographer

    Joined:
    Nov 1, 2001
    Messages:
    2,489
    Likes Received:
    0
     
  9. Thom B

    Thom B Stunt Coordinator

    Joined:
    Jan 11, 1999
    Messages:
    213
    Likes Received:
    0
    I'd just reccomend creating a cmd script in notepad, then point to it with task scheduler.

    e.g. You want to kill word at 3 am.

    in notepad type-
    taskkill /IM word.exe
    exit

    save as kill_word.cmd

    point to the above with task scheduler and set to run at 3 am.

    If you want a log file of the results you can use the following.

    taskkill /IM word.exe >> c:logskill_log.log

    Dunno if this answers your question or not. Post more specifics if this isn't what you're after.

    T
     
  10. Vince Maskeeper

    Vince Maskeeper Producer

    Joined:
    Jan 18, 1999
    Messages:
    6,499
    Likes Received:
    0
    Thom,

    That, in theory looks exactly like what I'm looking for... however...

    Just in testing, trying to run a cmd file with taskkill gives the following error:


    I assume this is a strict XP only command (I was experimenting here at work on a 2000 box)...

    When adding the log generation, it creates the killlog, but it is empty.
     
  11. John_Berger

    John_Berger Cinematographer

    Joined:
    Nov 1, 2001
    Messages:
    2,489
    Likes Received:
    0
    Vince,

    As I mentioned earlier this command *is* available for Windows 2000; however, you need the Windows Resource Kit. So it's not restricted to XP; it's just that it's not immediately available for Windows 2000. I can try to pull some strings here at work (since we're a Microsoft partner - unfortunately) to see if I can at least get the executable to you if you want.

    Actually, I would not be surprised if the XP executable will work on Windows 2000. Then again, Microsoft is notorious for OS checking on their command line executables.
     
  12. Thom B

    Thom B Stunt Coordinator

    Joined:
    Jan 11, 1999
    Messages:
    213
    Likes Received:
    0
    Ahh. Head to this link Sysinternals pskill and download the pstools. It will include pskill.exe. Substitute this for taskkill.exe in the above script. You won't need the /IM switch. e.g. pskill word.exe >> logfile.log
    The log was be empty because taskkill didn't run. The '>>' sends any text output from the command that would normally go to the console window into whatever log file you want to generate. As taskkill never ran, it didn't produce any output. '>' will overwrite whatever is in the target file, '>>' appends to what is already present in the file.
     
  13. Vince Maskeeper

    Vince Maskeeper Producer

    Joined:
    Jan 18, 1999
    Messages:
    6,499
    Likes Received:
    0
    Well, it's for an XP machine- so I'll play with that when I'm home. If it works under XP, rockin'.

    -V
     
  14. Thom B

    Thom B Stunt Coordinator

    Joined:
    Jan 11, 1999
    Messages:
    213
    Likes Received:
    0
    Yeah. It'll definitely go on XP.

     
  15. Wayne Bundrick

    Wayne Bundrick Cinematographer

    Joined:
    May 17, 1999
    Messages:
    2,358
    Likes Received:
    0
    Microsoft adds new command line stuff to each new version, and they taketh away too. I got a little upset when I found Qbasic was gone. So I reached out across the LAN and snatched a copy from one of our NT4 machines. It still works on Win2K and XP. But it's less likely that something from XP will work in Win2K or NT4, especially when it gets into the internals to do things such as killing tasks.
     
  16. Vince Maskeeper

    Vince Maskeeper Producer

    Joined:
    Jan 18, 1999
    Messages:
    6,499
    Likes Received:
    0
    Thanks Thom, exactly what I needed!

    -Vince
     
  17. Thom B

    Thom B Stunt Coordinator

    Joined:
    Jan 11, 1999
    Messages:
    213
    Likes Received:
    0
    [​IMG] glad to help.
     
  18. Kimmo Jaskari

    Kimmo Jaskari Screenwriter

    Joined:
    Feb 27, 2000
    Messages:
    1,528
    Likes Received:
    0
    The free tools at sysinternals really kick butt, been using them myself for a while now. Great for a sysadmin on a local network, you can even remotely list processes on systems and kill them etc (assuming you're logged in as a domain admin).
    They have other stuff too like defragging utilities etc, highly recommended site.
    Direct link to the utilities is http://www.sysinternals.com/ntw2k/utilities.shtml
     

Share This Page