Write a bash shell script called psping which checksperiodically if a specific executable has a
live process. Following is the exactsynopsis:
psping [-c ###] [-t ###] [-u user-name]exe-name
Counts and echos number of live processes for a user,whose executable file is exe-name.
Repeats this every second indefinitely, unless passedother specifications using switches:
-c - limit amount of pings, e.g. -c 3. Default isinfinite
-t - define alternative timeout in seconds, e.g. -t 5.Default is 1 sec
-u - define user to check process for. Default is ANYuser.
Following are some examples. All of them are based on asystem that runs the following
Processes:
UID CMD
jack /opt/google/chrome/chrome--type=-broker
jack /opt/google/chrome/chrome--type=zygote
mark /opt/google/chrome/chrome--type=-broker
mark /usr/bin/java my.jar -jar ~/project/chrome--render
root /sbin/init splash
Write a bash shell script called psping which checks periodically if a specific executable has a live process. Following
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am