I have successfully created a VM as part of a Resource Group on Azure using Terraform. Next step is to ssh in the new machine and run a few commands. For that, I have created a provisioner as part of the VM resource and set up an SSH connection: If I run “terraform apply”, it seems to get into an
Tag: linux
Error retreiving database name wordpress
I was trying the below code to retrieve database name from wordpress configuration file. But somehow a single inverted comma at the beginning is causing trouble. As given below it shows the output without any special characters but the below error shows an issue. Answer carriage return (r) caused the issue. T…
Running statistics on multiple lines in bash
I have multiple HTTP headers in one giant file, separated with one empty line. I have approximately 10,000,000 of headers separated with an empty line. If I want to discover trends, like header order, I want to do aggregate headers to a one-liner (how I can aggregate lines ending with an empty line and do tha…
SonarQube MsBuild scanner on linux build agent
We build or dotnet core 1.1 projects on our own linux build agents in docker. (https://github.com/Microsoft/vsts-agent-docker) We would like to use Sonar to analyze our C# code. But it seems that the SonarQube MsBuild Scanner can’t run in linux environment. Does anybody know a workaround for this. We do…
Segmentation fault core dumped 2d array
I’m trying to compile a c code under linux using gcc-4.9 (tried also 5.4) while so, I faced a segmentation fault error. this is the part of code where the problem exists: automorf is an array n x n long (int automorf[n][n]) Can you please help correcting the problem? Answer Try this and see output we ha…
Virtual Machine Setup and syncing project dependencies
Hi I am using vagrant to run a local linux environment on my windows OS. The problem is, I am trying to run my python project on it but there are a whole lot of dependencies, including nltk, which takes a long time to download. Other than manually re-downloading and installing all the dependencies onto the VM…
How to get next param in linux shell command params?
I’m writing a shell script of this command: For ‘-w’ options, I want to process ‘/test.pcap’ into ‘$PWD/test.pcap’, so I write script like this: As we see, I want to get ‘/test.pcap’ by ‘$OPTARG’, but is none. So my question is how to get ̵…
Is it possible to reliably nest find -exec commands in linux?
I need to fix permissions on a large number of files from a subset of directories on a large nfs volume. In building up a solution, I started by using find to get a list of the directories I want: The directories all start with a number. I can successfully use this to exec a 2nd find. That find gets
How can I measure CPU time of a specific set of threads?
I run C++ program in Linux. There are several threads pool (for computation, for io, for … such things). The system call clock() gives me a way to measure the CPU time spent by all the CPU cores for the process. However, I want to measure the CPU time spent only by the threads in the computation threads…
No return after executing passwd command using ssh in script
I have one script which reads hosts IP from /etc/hosts file, do ssh and update the passwords there for the given user. However, the script is closed after setting password for the first host and not able to set password for rest of the hosts. Please find below files- /etc/hosts file- 172.x.x.x host1 172.x.x.x…