Skip to content

Commit

Permalink
adjusted daemonjob code and helloworld app output
Browse files Browse the repository at this point in the history
Signed-off-by: REGGEENR <[email protected]>
  • Loading branch information
reggeenr committed Jul 25, 2022
1 parent 8bb4de5 commit 6febbe6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
16 changes: 8 additions & 8 deletions daemonjob/daemonjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ func main() {
}
msg = "Hello " + target + "!"
}
fmt.Printf("%s\n", msg)

// Just for debugging... show the env vars if DEBUG is set
// Just for debugging...
envs := os.Environ()
sort.StringSlice(envs).Sort()
fmt.Printf("Envs:\n%s\n", strings.Join(envs, "\n"))

// If the 'SLEEP' env var is set then sleep for that many seconds
sleepDuration := 60
if t := os.Getenv("SLEEP"); t != "" {
len, _ := strconv.Atoi(t)
fmt.Printf("Sleeping %d", len)
time.Sleep(time.Duration(len) * time.Second)
sleepDuration, _ = strconv.Atoi(t)
}

fmt.Printf("%s\n", msg)

// Sleep for another 60 seconds and then re-do the execution
time.Sleep(time.Duration(60) * time.Second)
fmt.Printf("Sleeping for %d seconds ...\n", sleepDuration)
// Per default sleep for 60 seconds and then re-do the execution
time.Sleep(time.Duration(sleepDuration) * time.Second)
fmt.Printf("Sleeping [done]\n")
}
}
10 changes: 10 additions & 0 deletions helloworld/helloworld.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ func main() {
}
}

Debug(true, `. ___ __ ____ ____`)
Debug(true, `./ __)/ \( \( __)`)
Debug(true, `( (__( O )) D ( ) _)`)
Debug(true, `.\___)\__/(____/(____)`)
Debug(true, `.____ __ _ ___ __ __ _ ____`)
Debug(true, `( __)( ( \ / __)( )( ( \( __)`)
Debug(true, `.) _) / /( (_ \ )( / / ) _)`)
Debug(true, `(____)\_)__) \___/(__)\_)__)(____)`)
Debug(true, "")
Debug(true, "An instance of application '"+os.Getenv("CE_APP")+"' has been started :)")
Debug(true, "Listening on port 8080")
http.ListenAndServe(":8080", nil)
}
Expand Down

0 comments on commit 6febbe6

Please sign in to comment.