COMP-8567 Assignment 04 solution


Original Work


Rate this product

Write a Bash script named 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
 Log.txt must have at least 10 entries
 Submit two files: and log.txt
Sample Screenshot showing the output of ps-u and pstree