LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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, 02:39 PM   #1
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

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, 03: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,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
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, 08:30 PM   #3
NotionCommotion
Member
 
Registered: Aug 2012
Posts: 789

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, 03:49 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,397

Rep: Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777Reputation: 2777
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, 03:54 AM   #5
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,518
Blog Entries: 4

Rep: Reputation: 3817Reputation: 3817Reputation: 3817Reputation: 3817Reputation: 3817Reputation: 3817Reputation: 3817Reputation: 3817Reputation: 3817Reputation: 3817Reputation: 3817
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 04:13 AM
Problem accessing Windows SQL server from Red Hat Web Server mariap Linux - General 0 12-28-2008 05:46 PM
problem with nohup command and nohup file size vbseeker Linux - General 1 09-17-2006 11:36 AM

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

All times are GMT -5. The time now is 08:37 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
Open Source Consulting | Domain Registration