I made a python script running on background:
nohup python app.py &
then close the terminal, a few days later, I want to see this job, so I run
jobs
there list no jobs, but I'm sure the script app.py is still running.
jobs will only give you a list of process running under the session group of the bash shell. nohup processes run in their own session group. There are a number of simple commands you can run to check if your nohup'd process is still running, the simplest being lsof | grep nohup (this command may take a few seconds to run)
Related
I am executing a background process with the following command:
{ geth | node | whatever } &
When I check the jobs the status of this process is always Stopped.
If I add this command to a .sh file and I execute it the same way, it also happens.
Any idea why it is happening or any other solution to make background processes using just command lines?
Try running with nohup. You can analyse the nohup.out log if it still stops.
nohup script.sh
I'm trying to run a script, say script.py that does not take any input from the terminal in the background using nohup by
nohup python3 script.py &
This command worked perfectly the last time I used it (and the script kept running for days!), but some error interrupted the process and it stopped. Eventually, nohup.out contained no error. (Is it supposed to?)
Now, I'm trying to run the script again, but am failing to do so. I use the same command, and then open the running processes using top but I get:
[2]- Stopped nohup python3 script.py
[3]+ Stopped nohup python3 script.py
I am failing to understand why is this happening now. Any help is appreciated!
P.S: The script runs perfectly without nohup.
There is a benchmarking process, which should be run on a system. It takes maybe a day, so I would like to run it nohup. I use this command:
nohup bash ./run_terasort.sh > terasort.out 2>&1 &
After that I can see with PID in jobs -l output, but after closing PuTTy it stops(as I can see, when I login again).
This is a KVM virtualized machine.
You are using nohup right from what I know. But you have an issue detecting the process.
jobs -l only give the processes of current session. Rather try the below to display the process started in your initial session:
ps -eafww|grep run_terasort.sh|grep -v grep
On a Raspberry Pi 2 with Raspbian, I discovered that I can use crontab -e and then add a line like #reboot sudo /root/.nvm/v0.10.26/bin/node /root/tweetmonkey-raspi & to the table to start a node process on boot.
I can't figure out how to quickly kill that process. I don't see it in ps -e. What process is that running under?
Cron jobs are started by cron or crond, which will spawn sh to run your command. However, your command forked to run in the background, and then finished executing, so the node process is reparented to the root process, init.
I wrote a python script to work with a message queue and the script was launched by crontab. I removed from crontab but the root user of my linux system keeps launching it every 9 minutes.
I've rebooted system and restarted cron but this script keeps getting executed.
Any idea how to keep it from happening?
If you start a cron, service does not stop even if you delete the file in which you have specified the cron.
This link should help:
https://askubuntu.com/questions/313033/how-can-i-see-stop-current-running-crontab-tasks
Also, you can also kill your cron by looking its PId, using: ps -e | grep cron-name, then kill -9 PId