From a98acc90605293dcc12404cc1f9f0afc1b71c993 Mon Sep 17 00:00:00 2001 From: YuruC3 <98943911+YuruC3@@users.noreply.github.com> Date: Sat, 10 May 2025 10:20:04 +0200 Subject: [PATCH] Sketch version of systemd. Copied from Netflow repo. --- .../systemd/MD1200Fans.example.service | 27 +++++++++++++++++++ PC_CONTROL_CODE/systemd/MD1200Fans.service | 26 ++++++++++++++++++ PC_CONTROL_CODE/systemd/README.md | 8 ++++++ 3 files changed, 61 insertions(+) create mode 100644 PC_CONTROL_CODE/systemd/MD1200Fans.example.service create mode 100644 PC_CONTROL_CODE/systemd/MD1200Fans.service create mode 100644 PC_CONTROL_CODE/systemd/README.md diff --git a/PC_CONTROL_CODE/systemd/MD1200Fans.example.service b/PC_CONTROL_CODE/systemd/MD1200Fans.example.service new file mode 100644 index 0000000..2015c41 --- /dev/null +++ b/PC_CONTROL_CODE/systemd/MD1200Fans.example.service @@ -0,0 +1,27 @@ +[Unit] +Description=Netflow to InfluxDB script +After=multi-user.target network.target network-online.target +# Place in /etc/systemd/system/ + +[Service] +User=yuru +Group=yuru +Type=simple +Restart=on-failure +# EnvironmentFile=/etc/NetFlux/netflow.env +# User=myuser +WorkingDirectory=/etc/NetFlux/HQ/ +ExecStart=/etc/NetFlux/HQ/venv/bin/python3 /etc/NetFlux/HQ/HQnetflow.py --serve-in-foreground + +#StandardInput=tty-force + +# Log file will be create if it doesn't exist +StandardOutput=append:/var/log/HQNetFlowInflux.log +StandardError=append:/var/log/HQNetFlowInflux.errlog + +# StandardOutput=syslog +# StandardError=syslog +# SyslogIdentifier=NetFlowInflux + +[Install] +WantedBy=multi-user.target diff --git a/PC_CONTROL_CODE/systemd/MD1200Fans.service b/PC_CONTROL_CODE/systemd/MD1200Fans.service new file mode 100644 index 0000000..9598904 --- /dev/null +++ b/PC_CONTROL_CODE/systemd/MD1200Fans.service @@ -0,0 +1,26 @@ +[Unit] +Description=Netflow to InfluxDB script +After=multi-user.target network.target network-online.target +# Place in /etc/systemd/system/ + +[Service] +User= +Group= +Type=simple +Restart=on-failure +# EnvironmentFile=/etc/NetFlux/netflow.env +# User=myuser +WorkingDirectory=/dir/to/script/ +ExecStart=/dir/to/script'sVENV/venv/bin/python3 /dir/to/script/NetFlowCollect.py --serve-in-foreground +#StandardInput=tty-force + +# Log file will be create if it doesn't exist +StandardOutput=append:/var/log/NetFlowCollect.log +StandardError=append:/var/log/NetFlowCollect.errlog + +# StandardOutput=syslog +# StandardError=syslog +# SyslogIdentifier=NetFlowInflux + +[Install] +WantedBy=multi-user.target diff --git a/PC_CONTROL_CODE/systemd/README.md b/PC_CONTROL_CODE/systemd/README.md new file mode 100644 index 0000000..5b34f7f --- /dev/null +++ b/PC_CONTROL_CODE/systemd/README.md @@ -0,0 +1,8 @@ +# What you need to prepare + +virtual enviroment in python with installed packages + +python script and InfluxDB + +## Change stuff +In .service file change everything that has and /path/to/dir \ No newline at end of file