Skip to content
Advertisement

Tag: shell

why this code isn’t working in bash?

I am using tail -f to fetch log file and output of log this command is input to grep command with search for “ERROR” string and output of grep is used to create/write into a temporary file(tmpLog) . command : logfile content Issue is , i am not getting content in tmpLog file , although it is created but with

Searching and selecting strings from a file

I have a trouble in separating few exact ‘fields’ with strings and then putting them into .txt file. I need to extract ‘nologin’ users from /etc/passwd file and that is an easy step. I’m using this command: cat command gives me for example: and it is saved to file1.txt Now I have to extract from file1.txt a number (2, 3,

Starting a process using systemd on Linux: different behaviour using “su root -c”

We have a SignalR push server using Mono/Owin on a Linux Debian server. We perform a load test and we get a different behaviour according to how the push is started on systemd Working: ExecStart=/bin/su root -c ‘/usr/bin/mono –server mydaemon.exe -l:/var/run/mydaemon.pid’ Hanging after around 1k connections: ExecStart=/usr/bin/mono –server mydaemon.exe -l:/var/run/mydaemon.pid We may reproduce the different behaviour anytime: in the second

Error in code for parsing arguments

i learned bash very recently, and i’m trying to read arguments for my script. So i wrote this, but i get an error (and vim has highlited in pink the last double parenthesis in the 4th line) I get the following error when i run ./test -so doc1 Can anyone help me understand what’s wrong with my script? Answer It

Shell Mount and check directionairy existence

Just looking for some help with my mounting shell script, wondering if anyone could advice me on how to make it check for the directory at the mount point exists and is empty, or is created by the script if it does not exist Answer Your use of grep will return any mountpoint that contains the string /myfilesystem in… e.g:

Error concatenating var in bash script

I have a bash script that searchs for password for unrar files. I would like to concatenate result and at the end of the script notify result of execution, but I donĀ“t know why final_result var outputs “INIT-END”. Why does not concatenate in search_pass_and_unrar function? Thanks a lot, best regards. Answer Problem is here: Due to pipeline used here your

Irregular result in zombie example

I have problems with understanding the behavior of this code: When running in a Unix shell I get this result: But sometimes its only giving me this result without any shell prompt: I know it can be solved with wait() function in parent process. But I like to know: Why is result irregular? Could someone please explain what happening? Child

The Linux timeout command and exit codes

In a Linux shell script I would like to use the timeout command to end another command if some time limit is reached. In general: But I also want that my shell script exits when the command is failing for some reason. If the command is failing early enough, the time limit will not be reached, and timeout will exit

Advertisement