mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
only show actually installed deb packages - make sure to copy the new dpkg script to your hosts
git-svn-id: http://www.observium.org/svn/observer/trunk@3130 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -5,13 +5,14 @@
|
||||
if [ -x /usr/bin/dpkg-query ]; then
|
||||
DATE=$(date +%s)
|
||||
FILE=/tmp/observium-agent-dpkg
|
||||
|
||||
if [ ! -e $FILE ]; then
|
||||
dpkg-query -W --showformat='${Package} ${Version} ${Architecture} ${Installed-Size}\n' > $FILE
|
||||
dpkg-query -W --showformat='${Status} ${Package} ${Version} ${Architecture} ${Installed-Size}\n'|grep "^install"|cut -d\ -f4- > $FILE
|
||||
fi
|
||||
FILEMTIME=$(stat -c %Y $FILE)
|
||||
FILEAGE=$(($DATE-$FILEMTIME))
|
||||
if [ $FILEAGE -gt 1800 ]; then
|
||||
dpkg-query -W --showformat='${Package} ${Version} ${Architecture} ${Installed-Size}\n' > $FILE
|
||||
dpkg-query -W --showformat='${Status} ${Package} ${Version} ${Architecture} ${Installed-Size}\n'|grep "^install"|cut -d\ -f4- > $FILE
|
||||
fi
|
||||
echo "<<<dpkg>>>"
|
||||
cat $FILE
|
||||
|
||||
Reference in New Issue
Block a user