added service and timer files, aswell as Arch PKGBUILD
updated version in main.cpp to be a dependency from cmake
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
cmake_minimum_required(VERSION 3.31)
|
cmake_minimum_required(VERSION 3.31)
|
||||||
project(home_lab_watchdog_keepalive)
|
project(home_lab_watchdog_keepalive)
|
||||||
|
|
||||||
|
add_definitions(-DVERSION=${VERSION})
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
|
|
||||||
add_executable(home_lab_watchdog_keepalive main.cpp
|
add_executable(home_lab_watchdog_keepalive main.cpp
|
||||||
|
|||||||
24
PKGBUILD
Normal file
24
PKGBUILD
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# PKGBUILD
|
||||||
|
pkgname=arduino_watchdog
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Arduino based external watchdog to keep server online"
|
||||||
|
arch=('any')
|
||||||
|
license=('MIT')
|
||||||
|
makedepends=('cmake: build system used')
|
||||||
|
depends=('systemd>=257.6')
|
||||||
|
source=('git://git.server.4zellen.se/Zacharias/home-lab_watchdog_keepalive.git')
|
||||||
|
maintainer="Zacharias Zellén <zacharias@4zellen.se>"
|
||||||
|
url="https://git.server.4zellen.se/Zacharias/home-lab_watchdog_keepalive.git"
|
||||||
|
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "$srcdir/home-lab_watchdog_keepalive"
|
||||||
|
|
||||||
|
cmake -B build -S . -DVERSION="\"$pkgver\""
|
||||||
|
make -C build
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgver() {
|
||||||
|
cd "$srcdir/home-lab_watchdog_keepalive"
|
||||||
|
git describe --tags | sed 's/^v//;s/-/+/g'
|
||||||
|
}
|
||||||
8
arduino-watchdog-heartbeat.service
Normal file
8
arduino-watchdog-heartbeat.service
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Run the Heartbeat for Arduinoi based server watchdog
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
User=arduino_watchdog
|
||||||
|
ExecStart=/usr/bin/arduino-watchdog -b
|
||||||
|
Nice=0
|
||||||
8
arduino-watchdog-heartbeat.timer
Normal file
8
arduino-watchdog-heartbeat.timer
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Heartbeat timer for Arduino based watchdog
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnUnitActiveSec=5min
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
8
main.cpp
8
main.cpp
@@ -2,8 +2,11 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "str_utils.h"
|
#include "str_utils.h"
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
const char* VERSION = "0.0.1-DEV";
|
#ifndef VERSION
|
||||||
|
#define VERSION "unknown-DEV"
|
||||||
|
#endif
|
||||||
|
|
||||||
bool shortHand(const char* str, char shortHand);
|
bool shortHand(const char* str, char shortHand);
|
||||||
|
|
||||||
@@ -31,7 +34,8 @@ int main(const int argc, char** argv) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
std::cout << "Initialization :)" << std::endl;
|
std::cout << "Initialization :)" << std::endl;
|
||||||
// TODO: Add init system
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (strcmp(arg, "--heartbeat") == 0 || shortHand(arg, 'b')) {
|
else if (strcmp(arg, "--heartbeat") == 0 || shortHand(arg, 'b')) {
|
||||||
// TODO: Send heartbeat
|
// TODO: Send heartbeat
|
||||||
|
|||||||
Reference in New Issue
Block a user