LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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


Reply
  Search this Thread
Old 04-03-2017, 03:39 PM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

Rep: Reputation: Disabled
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
 
Old 04-03-2017, 04:32 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,820
Blog Entries: 15

Rep: Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664Reputation: 1664
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.
 
Old 04-03-2017, 09:30 PM   #3
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 761

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by MensaWater View Post
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?
 
Old 04-04-2017, 04:49 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,705

Rep: Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495Reputation: 2495
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.
 
Old 04-04-2017, 04:54 AM   #5
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,440
Blog Entries: 3

Rep: Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210Reputation: 2210
Quote:
Originally Posted by NotionCommotion View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hi I need to know that whether nohup command will run even if the server is bounced Jonajk Linux - Newbie 2 10-17-2011 05:13 AM
Problem accessing Windows SQL server from Red Hat Web Server mariap Linux - General 0 12-28-2008 06:46 PM
problem with nohup command and nohup file size vbseeker Linux - General 1 09-17-2006 12:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration