forked from ph84172/puppet-mod-lithnetamagent
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add facts.d script to monitor deployment
- Loading branch information
1 parent
ad70494
commit cb8185d
Showing
1 changed file
with
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# Apt is advertised as having an unstable command-line interface. The format of /var/lib/dpkg/status seems stable and grep will return 0 on finding one or more matches, 1 for no matches. | ||
grep 'Package: lithnetaccessmanageragent' /var/lib/dpkg/status &> /dev/null | ||
|
||
if [ $? != 0 ] | ||
then echo lithnet_agent=missing | ||
exit 0 # This bails us out of this facts script without bothering to run the rest of it | ||
fi | ||
|
||
# systemctl status returns 0 for running service, 4 for not running | ||
systemctl status LithnetAccessManagerAgent &> /dev/null | ||
|
||
if [ $? != 0 ] | ||
then echo lithnet_agent=installed_not_running | ||
exit 0 | ||
fi | ||
|
||
# To get this far without falling into an exit 0, the service must be running. | ||
echo lithnet_agent=running | ||
|