Linux - Newbie This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
|
|
04-03-2017, 02:39 PM
|
#1
|
Member
Registered: Aug 2012
Posts: 789
Rep:
|
Accessing server after using nohup
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...
Thanks
|
|
|
04-03-2017, 03:32 PM
|
#2
|
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
|
nohup php server.php &
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.
|
|
|
04-03-2017, 08:30 PM
|
#3
|
Member
Registered: Aug 2012
Posts: 789
Original Poster
Rep:
|
Quote:
Originally Posted by MensaWater
nohup php server.php &
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?
|
|
|
04-04-2017, 03:49 AM
|
#4
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,397
|
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.
|
|
|
04-04-2017, 03:54 AM
|
#5
|
LQ Guru
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,518
|
Quote:
Originally Posted by NotionCommotion
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.
|
|
|
All times are GMT -5. The time now is 08:37 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|