Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Dont think I'll have any luck here, but I dont suppose anyone knows of any software that will kill an app at a certain time, or after x amount of mins/hrs, as gracefully as possible?
The part in backtics gets executed and fed into the kill command.
ps: list the running processes
|: send the output to
grep: find everything that matches (the process name in question)
|: feed that into
grep -v grep: find everything that does not match "grep"
(since the first grep also results in finding itself)
|: feed the results into
cut -f1 -d' ': grab the first column with column seperators defined as a space
The result of all that is the process number to kill. Try experimenting with the individual commands and look at the man pages for each. Be careful what you use the kill command on!
Also, make sure the process you want to kill has a unique name or you may end up killing something else. Overall, I don't think this is the best way to do what you want but I don't know of any other way right offhand.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.