Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 07-03-2009, 03:54 AM   #1
LQ Newbie
Registered: Jul 2009
Distribution: Centos 5
Posts: 1

Rep: Reputation: 0
Question persistent shell for headless box - need to run commands and disconnect

I am running a headless Centos 5 box.

I need shell access to this server over LAN with the ability to run the command and disconnect without waiting for the command to finish. And then check back minutes/hours later.

I am using ssh but whenever I logout, the commands are lost. remote X using XDMCP is very slow and sometimes there is no workable desktop after login greater. Though I dont want to concentrate getting that sorted out unless its the only good way of achieving my objective.

I resort to scheduling the command using cron but I believe there could be other way to have a persistent console

Any pointers?
Old 07-03-2009, 04:12 AM   #2
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978Reputation: 1978
Try screen. See here for some detail. Basically you can launch a screen session on the remote machine, run your command, then detach the screen session from the terminal. Later you can re-open the screen session and see the progress of your command.
Old 07-03-2009, 06:24 AM   #3
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96
If the command isn't interactive, run it as 'nohup command &', and it'll keep running after you disconnect.



headless, persistent, shell

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
Shell Script - Change user & run multiple commands ijf99 Linux - Newbie 1 01-26-2009 07:15 AM
Recording all commands run on remote shell. AbecX Linux - Server 1 05-18-2007 09:42 AM
how can i run a shell scripts (or a number of commands )when a user logs in to a linu rddreamz Programming 4 05-20-2004 04:08 PM
PHP to run Shell commands Gear_freak2000 Linux - Software 4 06-04-2003 06:39 AM
shell problems ? cant run Java commands RedHat123 Linux - General 2 07-16-2002 11:29 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:14 PM.

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