TheSaint321
TheSaint321

Reputation: 450

Using nohup when trying to run a Python35 script?

I'm trying to run a python program on a linux server using a putty console pulling the program and packages from a folder uploaded to the server through WinSCP. When I run the program normally using command:

python35 program.py

It works perfectly and begins to run. The issue is that I need to run the program on the server when my computer is turned off and the putty window is gone.

I read that you can use nohup command to do this however whenever I run:

nohup python35 program.py &

It returns:

ignoring input and appending output to `nohup.out'
nohup: failed to run command `python35': No such file or directory

At this point the program doesn't run and an empty nohup.out file is created on the WinSCP.

Why does this happen? How can I fix it? I haven't been able to find any equivalent errors on SO so far.

Upvotes: 2

Views: 1938

Answers (1)

lifecrisis
lifecrisis

Reputation: 366

As established above in the comments, python35 is a shell alias. Since the nohup runs the given command within a subshell, aliases defined in the parent shell process will not be available.

Use the following command:

nohup /opt/rh/rh-python35/root/usr/bin/python program.py &

Upvotes: 2

Related Questions