some more tweaks and fixes

This commit is contained in:
2020-01-15 18:00:58 +01:00
parent a09cb9c1cd
commit 35de12b3e9
6 changed files with 69 additions and 36 deletions

View File

@@ -76,8 +76,9 @@ login:
}
func main() {
os.MkdirAll("/opt/tmp", os.ModeDir)
SetupCloseHandler()
if viper.GetBool("no_run_on_start") {
if !viper.GetBool("no_run_on_start") {
go cronTask()
}
@@ -155,13 +156,13 @@ func cronTask() error {
var fbPostErr error
postID, fbPost, fbPostErr = page8(taskCtx)
fmt.Printf("Error: %#v\n", fbPostErr)
if fbPost.TimeStamp != lastUpdatePosted {
if fbPost != nil && fbPost.TimeStamp != lastUpdatePosted {
page9(taskCtx, postID)
}
time.Sleep(2 * time.Second)
if fbPost.TimeStamp != lastUpdatePosted {
if fbPost != nil && fbPost.TimeStamp != lastUpdatePosted {
timeStamp := fbPost.TimeStamp
pTime, err := time.Parse(time.RFC3339, fbPost.TimeStamp)
if err == nil {