Browse Source

new systemd service file, make demotape less spammy

master
Andreas Demmelbauer 4 years ago
parent
commit
8717ea3ede
2 changed files with 10 additions and 7 deletions
  1. +2
    -2
      demotape.py
  2. +8
    -5
      demotape.service

+ 2
- 2
demotape.py View File

@@ -117,10 +117,10 @@ def process_channel(channel):
while True: while True:
#print('checking ' + channel['name']) #print('checking ' + channel['name'])
if check_stream(channel['url']): if check_stream(channel['url']):
print(channel['name'] + ': found stream! Downloading ...')
print(channel['name'] + ': stream online! Downloading ...')
download_stream(channel) download_stream(channel)
else: else:
print(channel['name'] + ': no stream')
# print(channel['name'] + ': stream offline')
# wait between checks # wait between checks
waitingtime = random.randint(20,30) waitingtime = random.randint(20,30)
time.sleep(waitingtime) time.sleep(waitingtime)


+ 8
- 5
demotape.service View File

@@ -1,13 +1,16 @@
[Unit] [Unit]
Description=checks regulary the webstreams of all district parlaments in vienna. Online streams get taped.
Description=Demotape - Automatic stream taping for viennese district parlaments.
After=multi-user.target After=multi-user.target


[Service] [Service]
Type=idle
User=pi
ExecStart=/usr/bin/python3 /path/to/demotape.py > /var/log/demotape.log 2>&1
Type=simple
User=root
ExecStart=/usr/bin/python3 -u /home/demotape/demotape/demotape.py /var/www/static-files/
StandardOutput=file:/var/log/demotape.log
StandardError=file:/var/log/demotape_error.log

Restart=always Restart=always
RestartSec=10 RestartSec=10


[Install] [Install]
WantedBy=multi-user.target
WantedBy=multi-user.target

Loading…
Cancel
Save