-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lars T Hansen
committed
Apr 8, 2024
1 parent
b67d447
commit d77afda
Showing
5 changed files
with
62 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
( cd .. ; cargo build ) | ||
numbad=$(../target/debug/sonar ps --exclude-commands bash,sh,zsh,csh,ksh,tcsh,kworker | \ | ||
awk " | ||
/,cmd=kworker/ { print } | ||
/,cmd=(ba|z|c|k|tc|)sh/ { print } | ||
" | \ | ||
wc -l) | ||
if [[ $numbad -ne 0 ]]; then | ||
echo "Command filtering did not work" | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
( cd .. ; cargo build ) | ||
# System jobs have uid < 1000. For each user name UNAME, run `getent passwd $UNAME` and then | ||
# extract the third field from the colon-separated list to get the uid. | ||
numbad=$(../target/debug/sonar ps --exclude-system-jobs | \ | ||
awk ' | ||
{ | ||
s=substr($0, index($0, ",user=")+6) | ||
s=substr(s, 0, index(s, ",")-1) | ||
uids[s] = 1 | ||
} | ||
END { | ||
s = "" | ||
for ( uid in uids ) { | ||
s = s " " uid | ||
} | ||
system("getent passwd " s) | ||
} | ||
' | \ | ||
awk -F: '{ if ($3 < 1000) { print $3 } }' | \ | ||
wc -l | ||
) | ||
if [[ $numbad -ne 0 ]]; then | ||
echo $numbad | ||
echo "System jobs filtering did not work" | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
( cd .. ; cargo build ) | ||
numbad=$(../target/debug/sonar ps --exclude-users root,root,root,$LOGNAME | \ | ||
awk " | ||
/,user=root,/ { print } | ||
/,user=$LOGNAME,/ { print } | ||
" | \ | ||
wc -l) | ||
if [[ $numbad -ne 0 ]]; then | ||
echo "User name filtering did not work" | ||
exit 1 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters