

See that ping 1>/dev/null & does the job. Most processes can be fooled by redirecting its stdout, stderr, stdin (not all descriptors are always necessary to redirect) and using & control operator. If you want to make this script started automatically on system start -Īnytime you can view how your script is running # systemctl daemon-reload # systemctl start myPythonScript UPD: as Fox mentioned, screen works badly with systemd, but we can use systemd to start the script, like they say in official example.įor example, if your script is started by /usr/bin/myPythonScript, you can create Systemd unit file, like this.

This will reattach your terminal to the shell with the Python script you left running in background. To see how your script is running, you can call screen -r. It will detach your terminal from the shell that is running your script.įurthermore, the script is still running in it. Then you can press Ctrl+ Shift+ A then D. In this shell, you can start your Python script. To install it, run apt-get install screen for deb-based Linux distros, orĭnf install -y screen or yum install -y screen for RPM-based ones.Ī new shell is started. The screen tool, available for all Linux distros, supports this.
