What's new

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

Vince Maskeeper

Senior HTF Member
Joined
Jan 18, 1999
Messages
6,500
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
 

Patrick Larkin

Screenwriter
Joined
May 8, 2001
Messages
1,759
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.
 

Wayne Bundrick

Senior HTF Member
Joined
May 17, 1999
Messages
2,358
In Windows XP (probably 2000 also) you can use the "at" command line scheduler to issue a taskkill command at a given time.
 

Vince Maskeeper

Senior HTF Member
Joined
Jan 18, 1999
Messages
6,500
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
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
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.
 

Patrick Larkin

Screenwriter
Joined
May 8, 2001
Messages
1,759
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...
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
If Windows has the at commands, then it should have cron. I suppose there is some sort of command line process viewer as well...
There is no "cron" command per se in any version of Windows. That functionality has been usurped by the Windows Task Scheduler. Unfortunately, the Task Scheduler will not kill tasks at a specific time but only when a process has been running for a certain amount of time. I suppose that if you know when the process starts you can utilize that function in the same method, but it prevents dynamic starting (start as whatever time) and static process killing (kill always at a specific time).
 

Thom B

Stunt Coordinator
Joined
Jan 11, 1999
Messages
213
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
 

Vince Maskeeper

Senior HTF Member
Joined
Jan 18, 1999
Messages
6,500
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.
 

John_Berger

Senior HTF Member
Joined
Nov 1, 2001
Messages
2,489
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.
 

Thom B

Stunt Coordinator
Joined
Jan 11, 1999
Messages
213
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.
 

Wayne Bundrick

Senior HTF Member
Joined
May 17, 1999
Messages
2,358
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.
 

Kimmo Jaskari

Screenwriter
Joined
Feb 27, 2000
Messages
1,528
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
 

Users who are viewing this thread

Sign up for our newsletter

and receive essential news, curated deals, and much more







You will only receive emails from us. We will never sell or distribute your email address to third party companies at any time.

Forum statistics

Threads
357,059
Messages
5,129,815
Members
144,281
Latest member
acinstallation240
Recent bookmarks
0
Top