diff --git a/copr_status.service b/copr_status.service index 1dbb371..22fea00 100644 --- a/copr_status.service +++ b/copr_status.service @@ -3,7 +3,7 @@ Description=Copr Status After=network.target [Service] -ExecStart=/usr/bin/plackup -Ilib +ExecStart=/usr/bin/perl -Ilib util/start.pl WorkingDirectory=path/to/copr-status Restart=on-failure diff --git a/util/start.pl b/util/start.pl new file mode 100644 index 0000000..4bf6a1c --- /dev/null +++ b/util/start.pl @@ -0,0 +1,26 @@ +use CoprStatus; +use YAML::XS 'LoadFile'; + +my $config = LoadFile('config.yaml'); + +sub update_files { + while(1) { + my $user = $config->{User}; + my $repo_index = 0; + foreach my $branch (@{$config->{Branches}}) { + CoprStatus::download_specs($branch, $user, ${$config->{Repositories}}[$repo_index]); + $repo_index += 1; + } + + sleep $config->{UpdateRate}; + } +} + +my $child_pid = fork(); +if($child_pid) { + update_files(); + exit(0); +} + +system("plackup -Ilib"); + diff --git a/util/update_files.pl b/util/update_files.pl deleted file mode 100644 index 9f84366..0000000 --- a/util/update_files.pl +++ /dev/null @@ -1,20 +0,0 @@ -use CoprStatus; -use YAML::XS 'LoadFile'; - -my $config = LoadFile('config.yaml'); - -sub update_files { - while(1) { - my $user = $config->{User}; - my $repo_index = 0; - foreach my $branch (@{$config->{Branches}}) { - CoprStatus::download_specs($branch, $user, ${$config->{Repositories}}[$repo_index]); - $repo_index += 1; - } - - sleep $config->{UpdateRate}; - } -} - -update_files(); - -- libgit2 0.21.2