Browse Source

Update service/timer, ASCII border

fix-precip
Kevin Mok 5 years ago
parent
commit
831dce0656
Signed by: Kevin-Mok GPG Key ID: AEA75288DC135CF5
  1. 2
      dark-sky.fish
  2. 5
      dark-sky.js
  3. 14
      dark-sky.service
  4. 9
      dark-sky.timer

2
dark-sky.fish

@ -1,3 +1,5 @@
#!/usr/bin/fish
source api-keys-fish.sh
# IBM
set curl_url "https://api.darksky.net/forecast/$DARK_SKY_KEY/43.8180904,-79.3350555?exclude=minutely%2Cdaily%2Calerts%2Cflags&units=auto"

5
dark-sky.js

@ -1,6 +1,6 @@
const log = console.log
const fs = require('fs')
const {table} = require('table')
const {table, getBorderCharacters} = require('table')
const HOURS_AHEAD = 12
@ -30,7 +30,8 @@ jsonReader('./dark-sky.json', (err, weatherInfo) => {
0: { alignment: 'center' },
1: { alignment: 'center' },
2: { alignment: 'center' },
}
},
border: getBorderCharacters(`ramac`)
}
const infoList = [['H', '°C', '%P']]
for (let i = 0; i < HOURS_AHEAD; i++) {

14
dark-sky.service

@ -0,0 +1,14 @@
[Unit]
Description=Fetch local weather
[Service]
Type=oneshot
ExecStart=/home/kevin/weather/dark-sky.fish
User=kevin
Group=kevin
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/home/kevin/weather
[Install]
WantedBy=multi-user.target

9
dark-sky.timer

@ -0,0 +1,9 @@
[Unit]
Description=Fetch local weather
[Timer]
OnCalendar=6,12,18,00:00
Persistent=true
[Install]
WantedBy=timers.target
Loading…
Cancel
Save