Skip to content
Advertisement

Tag: bash

Bash – How can i send notification once if a service is not running?

I am running the following script to check if my docker services are running. If a service isn’t running, the script sent a message to my rocketchat app via webhook like this: It works, but if a docker service is not running, i receive the message every minute again, because the script is running every minute via cronjob. So how

I am trying to use awk to extract a portion of each line in my file

I have a large file of user agent strings, and I want to extract one particular section of each request. For input: I am trying to get output: from after /product/ in the sample above. I’m trying to use Awk, but I can’t figure out how to get the regex expression that’s required for this. I’m sure it’s simpler than

How to add number assigned as array

I have that script that is supposed to read data from two txt files and add them. For that matter I have used array. I can read the data but there is a problem with the addition. Instead of ${dataAll[$i]}= $( ${data1[$i]}+${data2[$i]} ), I have also used ‘expr ${data1[$i]}+${data2[$i]}’ The analysisSBM105.out file has the following But still it doesn’t work.

Search for log having value greater than certain time

Below is the sample log: Below is the desired output: When I use awk if it is exact time it will display the output otherwise it not displaying the output. Below is the code: Not displaying output: Displaying output: Besides that I got to find a solution. Below works but not as expected. Displaying output as expected: Displaying output. Expecting

Advertisement