-
Notifications
You must be signed in to change notification settings - Fork 1
/
11_get_procid.bash
executable file
·53 lines (47 loc) · 1.28 KB
/
11_get_procid.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#h-------------------------------------------------------------------------------
#h
#h Name: get_procid.bash
#h Type: Linux shell script
#h Purpose: gets the process, displays start/ stop command
#h Project:
#h Usage: ./get_procid.bash
#h Result:
#h Examples:
#h Outline:
#h Resources:
#h Platforms: Linux
#h Authors: peb piet66
#h Version: V1.0.0 2023-06-24/peb
#v History: V1.0.0 2022-12-11/peb first version
#h Copyright: (C) piet66 2022
#h License: MIT
#h
#h-------------------------------------------------------------------------------
MODULE='get_procid.bash';
VERSION='V1.0.0'
WRITTEN='2023-06-24/peb'
. `dirname $(readlink -f $0)`/00_constants >/dev/null
PROC=`pwd`/$BASH_NAME
ret=`ps -efj | egrep "$PROC" | grep -v grep | grep -v PGID`
echo ''
if [ "$ret" == "" ]
then
echo process $PROC is not started
else
#echo ret=$ret
user==`echo $ret | cut -f1 -d' '`
procid=`echo $ret | cut -f2 -d' '`
grpid=`echo $ret | cut -f4 -d' '`
pstree -ahclp $procid
echo ''
echo kill all processes of $PROC, user$user with:
echo "kill -- -$grpid"
fi
echo ''
echo 'start'
echo 'in foreground with:'
echo $PROC
echo 'in background with:'
echo $PROC '>/dev/null 2>&1 &'
echo ''