-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
examples: simple script examples used for testing
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Loading branch information
Showing
4 changed files
with
52 additions
and
0 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,11 @@ | ||
#!/bin/sh | ||
|
||
PID=$(pidof sysrepo-plugind) | ||
if [ -z "$PID" ]; then | ||
# logger -sk -t monitor -I $PPID -p user.error "sysrepo-plugind is not running" | ||
exit 0 | ||
fi | ||
MEM=$(awk '/VmRSS/{print $2}' /proc/$PID/status) | ||
|
||
logger -sk -t monitor -I $PPID -p user.notice "sysrepo-plugind memory usage: $MEM kB" | ||
exit 0 |
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,22 @@ | ||
#!/bin/sh | ||
|
||
role=$1 | ||
code=$2 | ||
pid=$3 | ||
label=$4 | ||
|
||
case $code in | ||
3) | ||
logger -sp user.err -I $$ "process $pid failed a kick, cause $code, restarting service." | ||
;; | ||
5) | ||
logger -sp user.err -I $$ "process $pid failed to meet its deadline, cause $code" | ||
logger -sp user.err -I $$ "this cause is unrecoverable, exit 1!" | ||
exit 1 | ||
;; | ||
*) | ||
;; | ||
esac | ||
|
||
logger -sp user.err -I $$ "system recovered, exit 0" | ||
exit 0 |
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,18 @@ | ||
#!/bin/sh | ||
|
||
TEMP=/sys/class/thermal/thermal_zone0/temp | ||
|
||
check() | ||
{ | ||
awk '{temp=$1; temp=temp/1000; rc=sprintf("%.1f", temp); exit rc < 55.0 }' < "$1" | ||
} | ||
|
||
if [ ! -f "$TEMP" ]; then | ||
logger -sk -t tempmon -I $PPID -p user.warn "No such sensor $TEMP" | ||
exit 1 | ||
fi | ||
|
||
if check "$TEMP"; then | ||
echo "Too hot!" | ||
exit 10 | ||
fi |