Score:0

Can you get the grep command to EXIT 1 if query successful?

it flag

I'm trying to formulate a docker healthcheck that restarts the container if the word FATAL in found in a certain log file. Something similar to this except with grep.

test: ["CMD-SHELL", "curl -f http://localhost || exit 1"]

Something like:

test: ["CMD-SHELL", "grep -i 'fatal' /var/log/log.txt || exit 1"]

Would that work?

djdomi avatar
za flag
you can consider & and && as it ststaes for error and success, you may try `echo default & echo failed &&echo successfully `
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.