Skip to content

How do I grep out multiple lines of the same pattern?

I have a log file that is filled with exceptions that is not useful to me. It is being generated every two second and when looking at log file that contains 24 hrs of logging it becomes overwhelming to get to the relevant info I need. My logs look something like this: I want to clean up the copy of

“Fire and forget” a process from a Python script

How do I start a process (another Python script, for example) from a Python script so the “child” process is completely detached from the “parent”, so the parent can a) continue on its merry way without waiting for child to finish and b) can be terminated without terminating the child …

Nginx(proxy) + Apache: two process listening same port

I have two servers on CentOS: Nginx(proxy) + Apache. I need restart Nginx but if i try to test configuration before restart, i have next error: How i can solve this problem? Thanks! P.S. Nginx has listen port 80, apache listen 81. Answer I don’t know why this error has appeared, but after I made error h…

How to terminate process from Python using pid?

I’m trying to write some short script in python which would start another python code in subprocess if is not already started else terminate terminal & app (Linux). So it looks like: Have problem of lacking knowledge to name proces by pid which app reads from file “.proc”. The other prob…

gmon.out is not created when executable forks another executable

I am using gprof for profiling. But gmon.out is not created when I fork another executable inside the main executable which is compiled with option -pg. Any idea how to resolve it. Answer But gmon.out is not created when I fork another executable It probably does. It simply has the same name as all the other …

Delete files older than X minutes

I would like to delete files that are older than 59 minutes. I have this so far: This doesn’t work and seems to delete all files. I’ve tested this several times and I think the issue is to do with daystart. I’ve read the man page and it seems to base time on the beginning of the day rather t…

Multithreaded Programming with Bash Script

I am running a bash script as like that: Every time when I send a request I have to wait to finish it and write to a file and after that it continues to looping. However I want to do it asynchronously. I mean that it will send a request and loop without waiting response. However when a response comes

go install always uses GOROOT/bin instead of GOPATH

I’m having annoying issue with go install command. Every time I try to run it within the src directory of my GOPATH the resulted file is getting created in GOROOT/bin directory for some reason. I verified my environmental variables in .bashrc and also run ‘go env’ (see below) and couldn&#821…