Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
autoradio
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ale
autoradio
Commits
1b202d9d
Commit
1b202d9d
authored
5 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Use pkill to reload Icecast by default
At least it doesn't require sudo like using systemctl.
parent
2974da92
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
v2.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
node/icecast/controller.go
+3
-21
3 additions, 21 deletions
node/icecast/controller.go
with
3 additions
and
21 deletions
node/icecast/controller.go
+
3
−
21
View file @
1b202d9d
...
...
@@ -13,9 +13,9 @@ import (
"sync"
"time"
"git.autistici.org/ale/autoradio/util"
"git.autistici.org/ale/autoradio"
pb
"git.autistici.org/ale/autoradio/proto"
"git.autistici.org/ale/autoradio/util"
)
var
(
...
...
@@ -23,27 +23,9 @@ var (
// Timeout for all HTTP requests to the local Icecast.
icecastHTTPTimeout
=
5
*
time
.
Second
icecastReloadCmd
=
flag
.
String
(
"icecast-reload-command"
,
""
,
"Command to reload the icecast2 daemon"
)
)
const
(
systemdReloadCmd
=
"sudo systemctl reload icecast2.service || sudo systemctl restart icecast2.service"
debianReloadCmd
=
"/usr/sbin/service icecast2 reload || /usr/sbin/service icecast2 restart"
genericReloadCmd
=
"pkill -HUP icecast2"
icecastReloadCmd
=
flag
.
String
(
"icecast-reload-command"
,
"pkill -HUP icecast2"
,
"Command to reload the icecast2 daemon"
)
)
func
init
()
{
// Try to set a system-specific sane default for
// --icecast-reload-command.
if
_
,
err
:=
os
.
Stat
(
"/bin/systemctl"
);
err
==
nil
{
*
icecastReloadCmd
=
systemdReloadCmd
}
else
if
_
,
err
:=
os
.
Stat
(
"/usr/sbin/service"
);
err
==
nil
{
*
icecastReloadCmd
=
debianReloadCmd
}
else
{
*
icecastReloadCmd
=
genericReloadCmd
}
}
// IcecastController manages a local Icecast daemon.
//
// Managing the local Icecast instance is a less simple task than it
...
...
@@ -145,7 +127,7 @@ func (c *Controller) killSources(ctx context.Context, mounts []*pb.Mount) {
}
func
killSource
(
ctx
context
.
Context
,
m
*
pb
.
Mount
,
port
int
,
pw
string
)
error
{
v
ar
v
url
.
Values
v
:=
make
(
url
.
Values
)
v
.
Set
(
"mount"
,
autoradio
.
MountPathToIcecastPath
(
m
.
Path
))
req
,
err
:=
http
.
NewRequest
(
"GET"
,
fmt
.
Sprintf
(
"http://localhost:%d/admin/killsource?%s"
,
port
,
v
.
Encode
()),
nil
)
if
err
!=
nil
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment