How can I run a single Go program namend "gcinfo" (webcrawler with output in firebase) as a cron in Google appengine?
I was able to create a projekt-ID and upload the Go programm with the App SDK. The cron job was executed as defined in the cron.yaml every 15 minutes. There was no error. But i find no output in the log and firebase ist not written. After lots of changes in the app.yaml, gcinfo.yaml and cron.yaml with no result or Errors like (Error code 204). I am now totally confused about the settings in the yaml-files.
Can someone give or point me to a simple example of these settings? I want to run a single Go program as a cron in the app engine every 15 minutes.
My projekt structur is:
app.yaml
application: myproject
version: 1
runtime: go
api_version: go1
handlers:
- url: /.*
script: _go_app
cron.yaml
cron:
- description: Ausfuehrung des tasks gcinfo
url: /gcinfo
schedule: every 15 minutes from 05:30 to 23:00
timezone: Europe/Berlin
target: gcinfo
gcinfo.yaml
application: myproject
module: gcinfo
#version: 1
runtime: go
api_version: go1
handlers:
- url: /gcinfo\.*
script: gcinfo\gcinfo.go
My gcinfo.go has the following structure
package gcinfo
import (
...
)
....
func gcinfo() {
....
}
There are no errors with this configuration in the "goapp deploy" and the appengine reacts every 15 minutes for 6ms, but there is no output for the go programm gcinfo. I have already tryed to make gcinfo to main with same result.
I have found a solution and now the cron job runs and writes comments in the Job Control.
cron.yaml in myproject folder
cron:
- description: Ausfuehrung des tasks gcinfo
url: /gcinfo
schedule: every 15 minutes from 05:30 to 23:00
timezone: Europe/Berlin
app.yaml in the subfolder gcinfo
application: myproject
module: gcinfo
version: 1
runtime: go
api_version: go1
handlers:
- url: /gcinfo
script: _go_app
and the key changes in gcinfo.go (gcinfo subfolder)
package gcinfo
import (
"net/http"
...
"appengine"
"appengine/urlfetch"
)
func init() {
http.HandleFunc("/gcinfo", gcinfo)
}
...
func gcinfo(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
...
}
Only writing firebase engine does not work with the appengine. I'll have to do more research.