Skip to content

Commit

Permalink
Add flag to enable/disable get_channels
Browse files Browse the repository at this point in the history
  • Loading branch information
mergwyn committed Jan 30, 2024
1 parent 0cafcd8 commit 137c75d
Showing 1 changed file with 37 additions and 31 deletions.
68 changes: 37 additions & 31 deletions site-modules/profile/manifests/app/iptv.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#
#
class profile::app::iptv {
class profile::app::iptv (
Boolean $enable = false
) {
include cron
include profile::app::scripts

Expand All @@ -9,37 +11,41 @@
$packages = [ 'socat' ]
package { $packages: ensure => present }

if $enable {
# systemd timer to download channels
$adminemail = lookup('defaults::adminemail')
$_timer = @(EOT)
[Unit]
Description=Run get channels on boot and periodically

[Timer]
OnBootSec=20min
OnUnitActiveSec=6h

[Install]
WantedBy=timers.target
| EOT

$_service = @("EOT")
[Unit]
Description=runs channel download
Wants=getchannels.timer

[Service]
Type=oneshot
ExecStart=/bin/bash -c '${codedir}/iptv/update-xteve-plex 2>&1 | /usr/bin/mailx -E -s "%N output root@%H" ${adminemail}'

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

systemd::timer{'getchannels.timer':
timer_content => $_timer,
service_content => $_service,
enable => true,
$adminemail = lookup('defaults::adminemail')
$_timer = @(EOT)
[Unit]
Description=Run get channels on boot and periodically

[Timer]
OnBootSec=20min
OnUnitActiveSec=6h

[Install]
WantedBy=timers.target
| EOT

$_service = @("EOT")
[Unit]
Description=runs channel download
Wants=getchannels.timer

[Service]
Type=oneshot
ExecStart=/bin/bash -c '${codedir}/iptv/update-xteve-plex 2>&1 | /usr/bin/mailx -E -s "%N output root@%H" ${adminemail}'

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

systemd::timer {'getchannels.timer':
timer_content => $_timer,
service_content => $_service,
enable => true,
}
} else {
systemd::timer { 'getchannels.timer': ensure => absent }
}

#TODO xteve?
Expand Down

0 comments on commit 137c75d

Please sign in to comment.