Ejemplo n.º 1
0
func StartService(grabConfig *sdt.GrabService) (error, bool) {

	e := grabConfig.StartService()

	if e != nil {
		return e, grabConfig.ServiceRunningStat
	} else {
		if grabConfig.ServiceRunningStat {
			//s := Insertstatservice(grabConfig.ServiceRunningStat, grabConfig.Name)

			ks := new(knot.Server)
			ks.Log().Info(fmt.Sprintf("==Start '%s' grab service==", grabConfig.Name))
			knot.SharedObject().Set(grabConfig.Name, grabConfig)

			return nil, grabConfig.ServiceRunningStat //s.(*StatService).status
		}

		err, isStopService := StopService(grabConfig)
		if err != nil {
			return err, isStopService
		}
	}

	return nil, grabConfig.ServiceRunningStat

}
Ejemplo n.º 2
0
func StopService(grabConfig *sdt.GrabService) (error, bool) {
	e := grabConfig.StopService()
	if e != nil {
		return e, grabConfig.ServiceRunningStat
	}
	ks := new(knot.Server)
	ks.Log().Info(fmt.Sprintf("==Stop '%s' grab service==", grabConfig.Name))
	return nil, grabConfig.ServiceRunningStat
}