Skip to content
Advertisement

Tag: shell

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

exporting list of variables in docker run

We have a set of variables in env file as given below examples.env Now, docker run cannot substitute $B for /path/path1, due to its limitations So, I want to export the variable in launcher script and then call those variable using -e flag, as given below mydocker.sh Now how to create docker command to get all the variables? Following docker

How to log every single command executed from shell script

I am trying to find a way to record every single command that is executed by any user on the system. Things that I have came across earlier. It is possible to view shell commands executed from the terminal using ~/.bashrc_history file. There is a catch here, It logs only those commands which were executed interactively from bash shell/terminal. This

Show colored output in terminal when using the sh command

color.sh When typing $ ./color.sh the terminal outputs in the respective colors. However, when I type $ sh color.sh it does not output in the correct colors. Instead it gives me the output below. Is there any way to make $ sh color.sh print in the respective colors? Thanks. Answer Use this codes But better use printf Also take a

How to execute command line via input

I’ve read this and this, but didn’t make it work. Here’s my script: and it output things like: Now I’d juste like to execute it in the same line, but xargs makes all incoming into one line of arguments (and it doesn’t run it). xargs -0 doesn’t work either. And I’d like to run it using env -i to run

Advertisement