Write a script to check if the current user has any processes that have been running for more than one hour.  If the process has ran for more than one hour, the script should kill the process.  However, the script should not kill the bash shell (that the script is run from (or any others).  Commands that you may need to use might include ps, tr, tail, cat, cut, paste, echo, expr, date and kill.    Note: Your script must avoid killing all bash shells. Bash is most frequently listed in the results of ps as just bash, but can be listed  as /bin/bash, or as part of a running script as /bin/bash script1.sh. It’s also possible that it is being run out of some nonstandard directory (like ~/bin/bash for a custom version).   Note: This program will kill your graphical environment if you are using one. If you really want to see if it works, run it from console mode.

LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
5th Edition
ISBN:9781337569798
Author:ECKERT
Publisher:ECKERT
Chapter7: Working With The Bash Shell
Section: Chapter Questions
Problem 5DE
icon
Related questions
Question
Write a script to check if the current user has any processes that have been running for more than one hour.  If the process has ran for more than one hour, the script should kill the process.  However, the script should not kill the bash shell (that the script is run from (or any others).  Commands that you may need to use might include ps, tr, tail, cat, cut, paste, echo, expr, date and kill. 
 
Note: Your script must avoid killing all bash shells. Bash is most frequently listed in the results of ps as just bash, but can be listed  as /bin/bash, or as part of a running script as /bin/bash script1.sh. It’s also possible that it is being run out of some nonstandard directory (like ~/bin/bash for a custom version).
 
Note: This program will kill your graphical environment if you are using one. If you really want to see if it works, run it from console mode.
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:
9781337569798
Author:
ECKERT
Publisher:
CENGAGE L
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L