changed syntax
This commit is contained in:
parent
c39bb24c42
commit
5a771084c4
6 changed files with 0 additions and 0 deletions
8
config-files/exec-ups.c
Normal file
8
config-files/exec-ups.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
system("/bin/ups &");
|
||||
return 0;
|
||||
}
|
17
config-files/portainer.yml
Normal file
17
config-files/portainer.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
version: '3.0'
|
||||
|
||||
services:
|
||||
portainer:
|
||||
container_name: portainer
|
||||
image: portainer/portainer-ce:latest
|
||||
restart: always
|
||||
stdin_open: true
|
||||
tty: true
|
||||
network_mode: bridge
|
||||
ports:
|
||||
- "9000:9000/tcp"
|
||||
environment:
|
||||
- TZ=Europe/Amsterdam
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- /opt/portainer:/data
|
6
config-files/traefik.labels
Normal file
6
config-files/traefik.labels
Normal file
|
@ -0,0 +1,6 @@
|
|||
traefik.enable=true
|
||||
traefik.http.routers..entrypoints=web/websecure/webfederation
|
||||
traefik.http.routers..rule=Host("")
|
||||
traefik.http.routers..tls=true
|
||||
traefik.http.routers..tls.certresolver=staging/production
|
||||
(optional) traefik.http.services..loadbalancer.server.port=
|
45
config-files/treafik.yml
Normal file
45
config-files/treafik.yml
Normal file
|
@ -0,0 +1,45 @@
|
|||
version: '3.0'
|
||||
|
||||
services:
|
||||
traefik:
|
||||
container_name: traefik
|
||||
image: traefik:latest
|
||||
restart: unless-stopped
|
||||
command:
|
||||
#- --api.insecure=true
|
||||
#- --api.dashboard=true
|
||||
- --providers.docker=true
|
||||
- --providers.docker.exposedByDefault=false
|
||||
- --providers.docker.network=proxy
|
||||
|
||||
- --entryPoints.web.address=:80
|
||||
- --entrypoints.web.http.redirections.entrypoint.to=websecure
|
||||
- --entrypoints.web.http.redirections.entrypoint.scheme=https
|
||||
- --entryPoints.websecure.address=:443
|
||||
- --entryPoints.webfederation.address=:8448
|
||||
|
||||
- --certificatesresolvers.staging.acme.email={email}
|
||||
- --certificatesresolvers.staging.acme.storage=/ssl-certs/acme.json
|
||||
- --certificatesresolvers.staging.acme.caServer="https://acme-staging-v02.api.letsencrypt.org/directory"
|
||||
- --certificatesresolvers.staging.acme.httpChallenge.entryPoint=web
|
||||
|
||||
- --certificatesresolvers.production.acme.email={email}
|
||||
- --certificatesresolvers.production.acme.storage=/ssl-certs/acme.json
|
||||
- --certificatesresolvers.production.acme.caServer="https://acme-v02.api.letsencrypt.org/directory"
|
||||
- --certificatesresolvers.production.acme.httpChallenge.entryPoint=web
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
#- "8080:8080"
|
||||
- "8448:8448"
|
||||
networks:
|
||||
proxy:
|
||||
ipv4_address: 172.21.0.80
|
||||
volumes:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /opt/traefik/ssl-certs:/ssl-certs
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
external: true
|
51
config-files/ups.c
Normal file
51
config-files/ups.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
unsigned int chargelim = 80;
|
||||
unsigned int charge = 100;
|
||||
|
||||
unsigned int voltagelim = 210;
|
||||
unsigned int voltage = 240;
|
||||
|
||||
|
||||
FILE *fp;
|
||||
char path[1024];
|
||||
|
||||
while(charge > chargelim || voltage > voltagelim)
|
||||
{
|
||||
sleep(20);
|
||||
fp = popen("/usr/bin/upsc ups@{domain} battery.charge 2>&1 |grep -v 'Init SSL'", "r");
|
||||
|
||||
if(fgets(path, sizeof(path), fp) != NULL)
|
||||
{
|
||||
charge = atoi(path);
|
||||
pclose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
pclose(fp);
|
||||
system("poweroff");
|
||||
}
|
||||
|
||||
fp = popen("/usr/bin/upsc ups@{domain} input.voltage 2>&1 |grep -v 'Init SSL'", "r");
|
||||
|
||||
if(fgets(path, sizeof(path), fp) != NULL)
|
||||
{
|
||||
voltage = atoi(path);
|
||||
pclose(fp);
|
||||
}
|
||||
else
|
||||
{
|
||||
pclose(fp);
|
||||
system("poweroff");
|
||||
}
|
||||
}
|
||||
|
||||
system("poweroff");
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue