Skip to content
Advertisement

Linux IPC: shared memory recovery

I have two processes (a producer and a consumer) communicating via a shared memory segment produced using the ‘old’ interface rather than mmap: The producer process could be restarted due to an error or configuration change. It creates a new region each time using the IPC_CREAT flag to shmget(). I have noticed that the consumer can continue to read from

Replacing line of text cointing using sed

I’m trying to replace document.querySelector(‘.popup’).classList.add(‘active’) by document.querySelector(‘.popup’).classList.add(‘noactive’) Answer You can use See the online demo. The regex is POSIX BRE compliant and matches (document.querySelector(‘.popup’).classList.add(‘) – Group 1 (1): a literal document.querySelector(‘.popup’).classList.add(‘ text (active’)) – Group 2 (2): a literal active’) text. Note the capturing groups in a POSIX BRE regex are set with (…). The literal dots need escaping and

A flask website, when it delete a file (os.remove(“abc.txt”)), the file is removed but the space is not reclaimed

The program is a standard flask program, and it does some cleanup as part of the initialization. In the cleanup() procedure, using os.remove(“abc.txt”), I noticed that the file is removed, but not reclaimed by the OS. I use both “python website.py” and “gunicorn website:app” to run the application and both have the same problem, in Linux environment. In MacOS, I

How to create file with folders for all users in home directory

So for example we have 4 users in /home directory: What I am trying to achieve is that I create directories with files inside for all these users. For one user I can try something like: mkdir -p /home/user/dir/anotherdir && touch /home/user/dir/anotherdir/somefile. But I want a dynamic solution when I don’t know how many users are and nor their names.

Changing the file’s creation timestamp in Linux programmatically in C/C++

The statx() system call was added to Linux kernel and now it is possible to get the creation (birth) time of the file from statx.stx_btime stucture field on supported filesystems. But I can’t find any support in utimensat() of similar system calls. Is it possible to change file’s creation timestamp in C/C++ and how? Answer statx.stx_btime is filesystem-specific. Linux has

How to list all concurrent python processes in my CLI?

I have opened several terminals in parallel: And in two of those terminals, I have launched a python file, which includes iterations, to keep the process running. And I would like to have the list of all python processes running. When I type: $ ps -ef | grep python or $ps -elf | grep python I only get the current

How should I deploy a web application to Debian?

Ideally I’d like to build a package to deploy to Debian. Ideally the installation process would check the system has the required dependencies installed, as well as configure Cronjobs, set up users etc. I’ve tried googling around and I understand a .deb is the format I can distribute in – but that is as far as I got since I’m

Advertisement