Content-Length: 246379 | pFad | http://github.com/miekg/gitopper/commit/73ab28f9f2b8d90cd2a4c72702080bef4389240d

10 The `Action` set might be `reload` and that would not start the unit.… · miekg/gitopper@73ab28f · GitHub
Skip to content

Commit

Permalink
The Action set might be reload and that would not start the unit. (
Browse files Browse the repository at this point in the history
…#80)

Should call `systemctl start` during bootstrap.
  • Loading branch information
tongson authored Aug 24, 2024
1 parent decbce2 commit 73ab28f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,9 @@ func run(exec *ExecContext) error {
if rerr := s.reload(); rerr != nil {
log.Warningf("Service %q, error running systemctl daemon-reload: %s", s.Service, rerr)
s.SetState(StateBroken, fmt.Sprintf("error running systemctl daemon-reload %q: %s", s.Upstream, rerr))
} else if err := s.systemctl(); err != nil {
log.Warningf("Service %q, error running systemctl: %s", s.Service, err)
s.SetState(StateBroken, fmt.Sprintf("error running systemctl %q: %s", s.Upstream, err))
} else if err := s.start(); err != nil {
log.Warningf("Service %q, error running systemctl start: %s", s.Service, err)
s.SetState(StateBroken, fmt.Sprintf("error running systemctl start %q: %s", s.Upstream, err))
// no continue; maybe git pull will make this work later
} else {
s.SetState(StateOK, "")
Expand Down
7 changes: 7 additions & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,13 @@ func (s *Service) enable() error {
return cmd.Run()
}

func (s *Service) start() error {
ctx := context.TODO()
cmd := exec.CommandContext(ctx, "systemctl", "start", s.Service)
log.Infof("running %v", cmd.Args)
return cmd.Run()
}

// Boot returns the start time of the service. If that isn't available because there isn't a Service in s, then we
// return the kernel's boot time (i.e. when the system we started).
func (s *Service) SetBoot() {
Expand Down

0 comments on commit 73ab28f

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/miekg/gitopper/commit/73ab28f9f2b8d90cd2a4c72702080bef4389240d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy