Skip to content

Commit

Permalink
Update Service to use Cache
Browse files Browse the repository at this point in the history
	modified:   CMakeLists.txt
	modified:   goveebttemplogger.cpp
	modified:   goveebttemplogger.service
  • Loading branch information
wcbonner committed Sep 29, 2023
1 parent 25d4c92 commit 426baaa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (POLICY CMP0141)
endif()

project (GoveeBTTempLogger
VERSION 2.20230928.1
VERSION 2.20230928.11
DESCRIPTION "Listen and log Govee Thermometer Bluetooth Low Energy Advertisments"
HOMEPAGE_URL https://github.com/wcbonner/GoveeBTTempLogger
)
Expand Down
6 changes: 3 additions & 3 deletions goveebttemplogger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1129,7 +1129,7 @@ void GenerateCacheFile(std::map<bdaddr_t, std::vector<Govee_Temp>> &AddressTempe
}
void ReadCacheDirectory(void)
{
const std::regex CacheFileRegex("gvh-[0-F]{12}-cache\.txt");
const std::regex CacheFileRegex("gvh-[[:xdigit:]]{12}-cache\.txt");
if (!CacheDirectory.empty())
{
if (ConsoleVerbosity > 1)
Expand Down Expand Up @@ -1735,7 +1735,7 @@ void ReadLoggedData(const std::filesystem::path& filename)
// Finds log files specific to this program then reads the contents into the memory mapped structure simulating MRTG log files.
void ReadLoggedData(void)
{
const std::regex LogFileRegex("gvh-[0-F]{12}-[0-9]{4}-[0-9]{2}\.txt");
const std::regex LogFileRegex("gvh-[[:xdigit:]]{12}-[[:digit:]]{4}-[[:digit:]]{2}\.txt");
if (!LogDirectory.empty())
{
if (ConsoleVerbosity > 1)
Expand Down Expand Up @@ -1863,7 +1863,7 @@ void WriteAllSVG()
}
void WriteSVGIndex(const std::filesystem::path LogDirectory, const std::filesystem::path SVGIndexFilename)
{
const std::regex LogFileRegex("gvh-[0-F]{12}-[0-9]{4}-[0-9]{2}\.txt");
const std::regex LogFileRegex("gvh-[[:xdigit:]]{12}-[[:digit:]]{4}-[[:digit:]]{2}\.txt");
if (!LogDirectory.empty())
{
if (ConsoleVerbosity > 0)
Expand Down
17 changes: 10 additions & 7 deletions goveebttemplogger.service
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ StartLimitIntervalSec=33
Type=simple
Restart=always
RestartSec=5
Environment="VERBOSITY=0"
Environment="LOGDIR=/var/log/goveebttemplogger"
Environment="TIME=60"
Environment="SVGARGS=--svg /var/www/html/goveebttemplogger/ --battery 8 --minmax 8 --titlemap /var/www/html/goveebttemplogger/gvh-titlemap.txt"
Environment="EXTRAARGS=--download"
ExecStartPre=/bin/mkdir -p ${LOGDIR}
ExecStart=/usr/local/bin/goveebttemplogger -v ${VERBOSITY} --log ${LOGDIR} --time ${TIME} $SVGARGS $EXTRAARGS
ExecStartPre=/bin/mkdir -p /var/log/goveebttemplogger
ExecStartPre=/bin/mkdir -p /var/www/html/goveebttemplogger
ExecStartPre=/bin/mkdir -p /var/cache/goveebttemplogger
ExecStart=/usr/local/bin/goveebttemplogger \
--verbose 0 \
--log /var/log/goveebttemplogger \
--time 60 \
--svg /var/www/html/goveebttemplogger --battery 8 --minmax 8 \
--cache /var/cache/goveebttemplogger \
--download
KillSignal=SIGINT

[Install]
Expand Down

0 comments on commit 426baaa

Please sign in to comment.