Feb-01-2020, 04:00 PM
Hi hopping you can help me solve a mystery.
I wrote a program to automaticity back up my media system. It does a few other things too, like keeping a log of what has been updated and being able to bring up a file count of all directory and there back ups.
The system is actually two programs. There is a frontend this is a small program that is opened in terminal, its basically a remote control for the backend. you open it when you need to check something, then close it after.
The backend is the heart of the program and is running in the background all the time.
This system is working flawlessly. But you have to start both programs individually. I thought it would be much neater to have a one click starts both programs. the script below starts the frontend in terminal, but before doing so checks to see if the backend is running, if not it starts it. When you close the frontend the backend remains running.
The script below works perfectly on my main system, the one I wrote it on. But when I transfer it to my media system, the backend fails to stay running when you close the front end.
Both systems are basically the same, both are ubuntu 18.4 both have python 3.
the only tiny difference I can find in the system is that my main system has python 3.6.9 the media system is python 3.6.8. can't believe this would make a difference.
Any ideas would be great thanks.
I wrote a program to automaticity back up my media system. It does a few other things too, like keeping a log of what has been updated and being able to bring up a file count of all directory and there back ups.
The system is actually two programs. There is a frontend this is a small program that is opened in terminal, its basically a remote control for the backend. you open it when you need to check something, then close it after.
The backend is the heart of the program and is running in the background all the time.
This system is working flawlessly. But you have to start both programs individually. I thought it would be much neater to have a one click starts both programs. the script below starts the frontend in terminal, but before doing so checks to see if the backend is running, if not it starts it. When you close the frontend the backend remains running.
The script below works perfectly on my main system, the one I wrote it on. But when I transfer it to my media system, the backend fails to stay running when you close the front end.
Both systems are basically the same, both are ubuntu 18.4 both have python 3.
the only tiny difference I can find in the system is that my main system has python 3.6.9 the media system is python 3.6.8. can't believe this would make a difference.
Any ideas would be great thanks.
#!/usr/bin/python3 import subprocess import socket import os try: clientsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) clientsocket.connect(('localhost', 8085)) except socket.error: subprocess.Popen([os.path.dirname(os.path.realpath(__file__))+"/backupnew1.py", "-a", "arg1", "-b", "arg2"]) p=subprocess.Popen(["gnome-terminal","--",os.path.dirname(os.path.realpath(__file__))+"/backup-client1.py"]) p.wait()