In the below code my friend has stimulated a dead lock situation with context switching and mutex lock in linux. The problem is, after execution it printed Statement 1,3 and 4 But the correct output should have been statements 1,3 and 2 But when I change the value of sleep in func2 to sleep(4) It works fine. …
bash if elif statement always prints first value
For some reason, the first value is always printed. I can’t figure out the reason behind it. Any ideas? I tried many things including single =, single [] but nothing seems to be working at all. Answer You need to add whitespace to the conditions:
blast could not create a unit counts container
I build a blast local database. However, when I run the blastn command I got this error message: T0 “/home/coremake/release_build/build/PrepareRelease_Linux64-Centos_JSID_01_250088_130.14.22.10_9008__PrepareRelease_Linux64-Centos_1448906370/c++/compilers/unix/../../src/algo/winmask/seq_masker_istat_fact…
How to forking process in a way such that reaping the child isn’t neccessary
I seem to have a vague memory that some facility in Linux exists that allows one to fork() a process in such a way that the child is automatically reaped by the system without a zombie being created. What is this mechanism? Or is my memory just wrong? Answer The portable way to do this is to double-fork:
dhclient not sending DHCPDISCOVER after $reason report TIMEOUT and valid lease are unreachable
I am using ISC dhclient 4.3.1 on my debian 8.3 Linux. When the $reason reported by dhclient is TIMEOUT due to valid lease from leases file cannot be reached, the dhclient-script exits with status 2. The dhclient is not sending DHCPDISCOVER msgs after this. However, when the $reason reported by dhclient is FAI…
C Shell to execute commands
I have the following code: The programme works fine, however when I parse something like “ps -f” it retunrs “execvp echoué”, as the code removes the spaces. What should I exactly do to make it accept comands with options such as ps -f? Answer You should use fgets() instead of scanf(). …
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, fo…
Move all files at one level up one level
I had a problem with a backup on a linux server that somehow moved all folders of files down one level into a new folder with the same name. I would like to return all files to their original location. Many of the files have spaces in their names to complicate things. Original directory structure: Incorrect d…
“Illegal instruction” when running ARM code targeting my CPU
I’m compiling a rather large project for ARM. I’m using an AT91SAM9G25-EK as a devboard running a Debian ARM image. All libraries and executables in the image seem to be compiled for the armv4t instruction set. My CPU is an ARM926EJ-S, which should run armv5tej code. I’m using GCC to cross c…
Invoking subshells from script does not work if run in background
I have a script running in background, like: Now this script, invokeTest.sh has contents: Although it prints, “Hello World from invokeTest” it does not call test.sh. My question: Is there any way to call test.sh in infinite while loop directly from su – insite1 -c” “so that we ca…