COMP-8567 Assignment 04 solution

$25.00

Original Work ?

Download Details:

  • Name: Assignment-4-rnscnh.zip
  • Type: zip
  • Size: 769.70 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (4 votes)

Write a Bash script named monitor.sh that continuously monitors all the current user processes (ps -u)
and whenever any user process p has more than 6 descendants, do the following:
1. Output the process tree with p as the root on the standard output (you can use pstree -p
processid). A sample output of pstree is shown in the screenshot below
Note: Consider all the descendants and not just the direct descendants.
2. A timestamp (date and time) is entered into log.txt followed by the contents of pstree -p processid
Submission Instructions:
ο‚· You are required test your program by dynamically creating or increasing the number of child
processes
ο‚· Log.txt must have at least 10 entries
ο‚· Submit two files: monitor.sh and log.txt
Sample Screenshot showing the output of ps-u and pstree