Skip to content
Advertisement

Tag: ksh

If grep value not found return an echo [korn shell]

I have an issue with this script. What I’m trying to do is there are 3 conditions: 1- i put a valid input that is found inside the file and it gives me the output 2- I put a wrong input that can’t be found inside the file and give me an output of “Value not Found” 3- I don’t

Need a way to check content of file (time data) is more than 5 minutes or not

I am creating a script to pull out the list of highest cpu consuming jobs on my server. I am taking the dump of processes in a flat file in below format: 202009080230,4.1,218579,padaemon,02:30,00:00:01,SD_RCC_FRU:wf_rcc_ds_CRS_FactSuspendedGdc_d.s_m_rcc_ds_Staging_Dimension_FactSuspendedGdc_ipi_d The second data point(4.1) is my cpu utilization while the sixth one is the time taken(00:00:01). I intend to filter out only the entries from this file

How to set and record alerts for Jenkin server down and up

I have Jenkins pipeline job which goes thought all our Jenkins servers and check the connectivity (runs every few minutes). ksh file: I would like to add another piece of code, which record all the times that server was down (it should include the name of the server and timestamp) into a file, and in case the server is up

Split string in ksh

I got a string as follow : What would be the best way to convert it in seconds without using date ? I tried something like this that sounded pretty nice but no luck : Any idea is welcome, I just can’t use date -d to make conversion as it is not present on the system I am working on.

Split file into multiple when special char met

I have a main file as following : My final goal is to create a file that will containt only block that contains a specific string, for example if that string would be lines then I would have an output file like this : To reach my objective, I first try to split my main file into subfiles by bock

empty an existing array in ksh

I have script which stores the list of files in an array as shown below I have to empty this my_array variable to use it for other purpose. I cannot declare another new array. Is there any way to clear the content of the array and reuse it again? Thanks in advance. Answer Since you’re already using set -A …

Linux file descriptor – getting current redirection stdout file?

I’m trying to get the current stdout redirection, and having some trouble. I have a script that is always run with stdout redirection ie: In myscript.sh, I need to find out what file it is being output to. I’m trying this currently (not working): That’s outputting logfile = /tmp/sflq.r3f, for instance. I need to instead find that it’s going to

How can I make a ksh script terminate itself if any issues?

I have written a few ksh scripts, about 6 scripts. These are written to handle huge data files, something like 207 MB big. while running the script, sometimes it gets stuck and does not end. Human interruption is required. In production environment, I want it to run automatically, and should be able to end automatically if any issues without the

Advertisement