Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Within a terminal, I entered the following (and think I was accidentally logged on as root). My desire was that the process would run even after the terminal was closed.
Code:
nohup php server.php &
I closed the connection by clicking the X on the putty terminal.
Then I tried to putty in again, but no go. Then tried ssh'ing in from a local machine I had with me, and got the following.
Code:
michael@raspberrypi3:~ $ ssh Michael@11.22.333.444
ssh: connect to host 11.22.333.444 port 22: Connection refused
michael@raspberrypi3:~ $
Am I still able to remotely access the machine?
PS. I should have read man nohup before doing such a thing...
What you did would do what you intended which is to run the "php server.php" in the background and keep it from disconnecting when you closed the terminal.
If you can't reach it now it wouldn't have anything to do with the nohup.
It might have something to do with whatever that server.php was designed to do. Do you know its purpose?
Restarting the device would cancel all processes including anything you put in background.
What you did would do what you intended which is to run the "php server.php" in the background and keep it from disconnecting when you closed the terminal.
If you can't reach it now it wouldn't have anything to do with the nohup.
It might have something to do with whatever that server.php was designed to do. Do you know its purpose?
Restarting the device would cancel all processes including anything you put in background.
server.php was just a reactphp server.
Can't reset the device at the moment as am on holiday.
Magically, I was later able to access. nohup wouldn't cause the server to reboot, would it?
No, nohup just disconnects the process from the terminal.
If server.php filled up the disk, that could explain why you couldn't connect.
Also, that could eventually trigger the OOM-killer (out of memory), which could likely cause a reboot.
You could check the logs to try and find out what happened.
Within a terminal, I entered the following (and think I was accidentally logged on as root). My desire was that the process would run even after the terminal was closed.
Code:
nohup php server.php &
If you want to be able to check on it as it is running, then use tmux or something like that to leave the remote session alive while you log out. In that way you can log back in periodically and check on the progress, or lack thereof. Also be sure to check the logs.
Also, if you really are on vacation, be sure to bill the appropriate rates even if you fell it would just be an exchange of hours off later.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.