I have to run some tests on a server at the University. I have ssh access to the server from the desktop in my office. I want to launch a python script on the server that will run several tests during the weekend.
The desktop in the office will go on standby during the weekend and as such it is essential that the process continues to run on the server even when the SSH session gets terminated.
I know about nohup
and screen
and tmux
, as described in questions like:
- How to keep processes running after ending ssh session?
- How can I close a terminal without killing the command running in it?
What am I doing right now is:
ssh username@server
tmux
python3 run_my_tests.py
-> this script does a bunch ofsubprocess.check_output
of an other script which itself launches some Java processes.- Tests run fine.
- I use Ctrl+B, D and I detach the session.
- When doing
tmux attach
I reobtain the tmux session which is still running fine, no errors whatsoever. I kept checking this for minutes and the tests run fine. - I close the ssh session
After this if I log in to the server via SSH, I do am able to reattach to the running tmux
session, however what I see is something like:
Traceback (most recent call last):
File "run_my_examples.py", line 70, in <module>
File "run_my_examples.py", line 62, in run_cmd_aggr
File "run_my_examples.py", line 41, in run_cmd
File "/usr/lib64/python3.4/subprocess.py", line 537, in call
with Popen(*popenargs, **kwargs) as p:
File "/usr/lib64/python3.4/subprocess.py", line 858, in __init__
restore_signals, start_new_session)
File "/usr/lib64/python3.4/subprocess.py", line 1456, in _execute_child
raise child_exception_type(errno_num, err_msg)
PermissionError: [Errno 13] Permission denied
I.e. the process that was spawning my running tests, right after the end of the SSH session, was completely unable to spawn other subprocesses. I have chmod
ed the permissions of all files involved and nothing changes.
I believe the servers use Kerberos for login/permissions, the server is Scientific Linux 7.2.
Could it be possible that the permissions of spawning new processes get removed when I log off from the ssh sessions? Is there something I can do about it? I have to launch several tests, with no idea how much time or space they will take...
- The version of
systemd
is 219 - The file system is AFS, using
fs listacl <name>
I can confirm that I do have permissions over the directories/files that are used by the script.
systemd-run --version
tells me the server is usingsystemd 219
. – Bakuriu Aug 05 '16 at 14:11while True:
loop and that script runs fine, is not killed and I'm able to resume it without problems. I have also tried to add somesubprocess
andmultiprocessing
calls and they work fine. I'm at a loss of what is happening. – Bakuriu Aug 05 '16 at 14:14df -T
it's an AFS file system. could this be that the various files are on different devices and I need a session to let a program access the data on other part of the file system? – Bakuriu Aug 05 '16 at 15:36fs listacl <name>
I am listed as having normal access to all relevant directories/files. – Bakuriu Aug 05 '16 at 15:41kinit && aklog
is doing the trick. I'm now verifying this by detaching, waiting some time rebooting and see if the processes are still running, or if they get the permission error. – Bakuriu Aug 05 '16 at 16:08