27 lines
436 B
Bash
Executable file
27 lines
436 B
Bash
Executable file
#!/bin/bash
|
|
|
|
UPDATE=$(apk update 2>&1)
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo "UNKNOWN - Fail to update packages lists"
|
|
echo -e "$UNKNOWN"
|
|
exit 3
|
|
fi
|
|
|
|
UPGRADES=$(apk -u list 2>&1)
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo "UNKNOWN - Fail to list available upgrades"
|
|
echo -e "$UPGRADES"
|
|
exit 3
|
|
fi
|
|
|
|
if [ -z "$UPGRADES" ]
|
|
then
|
|
echo "OK - System is uptodate"
|
|
exit 0
|
|
fi
|
|
|
|
echo "WARNING - $(echo -e "$UPGRADES"|wc -l) upgrades available"
|
|
echo -e "$UPGRADES"
|
|
exit 1
|