I have made a daemon service in linux server. It is running well. The service file is stargate.service (in /etc/systemd/system). If by some reasons, the daemon service is die and stop. Do you know how to make the system automatically restart the daemon service ? How to make the daemon service starts if server get rebooted? Answer To respawn your
Tag: process
Is pipe in linux asynchronous or not?
I thought that when i running below commands Linux process will be when sleep 10 is end -> sleep 2 (when sleep 2 is end)-> sleep 5 that’s i thought But in Linux bash sleep 10, sleep 2, sleep 5 are in ps same time Standard output of sleep 10 process will be redirected to sleep 5’s process But, in
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
waitpid() function returns ERROR (-1), why?
I’m writing a Linux shell-like program in C. Among others, I’m implementing two built-in commands: jobs, history. In jobs, I print the list of currently working commands (in the background). In history I print the list of all commands history until now, specifying for each command if it’s RUNNING or DONE. To implement the two, my idea was to have
Fork how many processes created confused
Say i have the following program So now what we have: Fork #1 creates an additional processes. so now we have two processes. Fork #2 is executed by two processes, creating two processes, for a total of four. My confusion is after the first fork we will have two processes P1(parent) and C1 (child). each process will execute the second
How to detect when a process is terminated in Linux using C++?
The purpose is I want my program running on Linux to be terminated when some random process is terminated. I can get PID or process handle of the process that my program is to monitor. Are there any possible approaches that I could take? Answer Linux 5.3 introduced pidfd_open, which lets you get a file descriptor from a PID. The
Pipe not reading what it should
So I have 2 processes, a client who gets 2 operands and one operation (either + or -), sends them to the second process, the server, who makes the computation, then sends the result back to the client. This is the client: This is the server: There are 3 outcomes to this code. First one is that it works, this
How do jps, jinfo, jstat, jmap and jstack get information about local Java processes?
How does jps get information about all the local java processes? Does it connect to some local server process to fetch the information? How do jinfo, jstat, jmap, and jstack get information about a local java process? Do they connect to some local server process(es) to fetch the information? Is jstatd only used for providing remote access to local java
Unable to exit while loop after reading information written to pipe
TLDR: You have to close the write end of all pipes in all children. The read will detect EOF only if no process has the write end still open. Credits to @Bodo As part of an assignment for an operating systems course, I’m trying to read lines from a file which is in the format of x operand y and
Are resource demanding process divided into multiple processes?
It is spotted on google cloud engine. Multiple instances of my script are created (by bash?). The reason might be that the script demands very high amount of memory. How is this division done exactly? Any performance impact? [UPDATE] My mistake. These instances are threads created by python. Answer Don’t overestimate the skills of the Python. Python is incapable to