Sponsored Content
Top Forums UNIX for Advanced & Expert Users How to keep program running after logout Post 302726145 by lepetal on Saturday 3rd of November 2012 05:44:43 PM
Old 11-03-2012
Quote:
Originally Posted by bipinajith
Code:
nohup <script> &

But you should use nohup before the script had run.

In my case, I just have run ssh, have run application & and exited from session. After that I have run ssh again and "ps aux | grep application" give me it's PID. I would like to attach this application to my new session. That's all.
 

10 More Discussions You Might Find Interesting

1. Programming

Running a compiled Program

Just getting into the Unix command line programming and am unable to run any program I write. I am using a Makefile and the source is compiling but when I enter the name of the output file I get back: bash: lab01exe.out: command not found I'm sure I am just dooing something simple... (2 Replies)
Discussion started by: Krebsbac
2 Replies

2. Shell Programming and Scripting

Running a program automatically

How can I make a program run automatically at a certain time of day? My problem is I need to make a small backup program that will back up a few files every day? (3 Replies)
Discussion started by: jvadn0
3 Replies

3. UNIX for Dummies Questions & Answers

Running a program

Hi.Iam new to Linux.i got linux 7.0 pro and dont know how to run programs. I want a perl interputer and i know i installed one but how do i run it ??? Also how do i run a C or C++ editor ?and how do i run cron ? (3 Replies)
Discussion started by: perleo
3 Replies

4. Programming

running a program for a specified time

how can i run a program for a specified time? i need to print a current time during program execution. (3 Replies)
Discussion started by: prosputko
3 Replies

5. Shell Programming and Scripting

Keep process running (wget) and logout

well, i have only been learning about linux, unix and shells for a few days. For my online game to work, i need run a file each 10 seconds. Running that file will update mysql data, causing my online game to "tick". This adds resources and fights battles in game. I know that i need to use a... (3 Replies)
Discussion started by: mikey1090
3 Replies

6. Programming

Running app after logout and monitoring

Hello! I just programmed a very simple app, it's function is to report every minute the state of the memory and cpu and put it to and xml. All this stuff is working ok since I'm logged in into the machine, but i want it to run as a service, how can I do that?? P.S: Any one knows how can I... (1 Reply)
Discussion started by: ncatdesigner
1 Replies

7. UNIX for Dummies Questions & Answers

Running a program (Dynflow)

Lets get some stuff out of the way before the question. I am currently running FreeBSD 7.0 on a VirtualBox virtual machine. I do not know much about Unix or FreeBSD, though I do run linux at home. My boss gave me some files that he says are a unix version of the program Dynflow. The Programs... (0 Replies)
Discussion started by: poet_will
0 Replies

8. UNIX for Dummies Questions & Answers

Keep process running on logout

Hey All, I'm logging in via an SSH shell. I'm wondering if there's a way to execute a command and it not die when I close my terminal window (or rather, logout of the SSH shell). Thanks, Nathan (3 Replies)
Discussion started by: NathanWarden
3 Replies

9. Shell Programming and Scripting

Help with Running More than One Program

Folks, I'm really new to scripting and was wondering if you could help me out. I have the following script that I inherited: #!/bin/bash # # Usage # From the agent directory: # ./run-any-agent AgentName # TAC_AGENT_HOME=`pwd` LIB=${TAC_AGENT_HOME}/lib CLASSPATH=.... (17 Replies)
Discussion started by: DTriniWay
17 Replies

10. Shell Programming and Scripting

Running a program using csh

I have a program which I can run on the command line like below and works fine /nethome/chrisd/HSeis/TommyCD/TommyCD-1101/bin/raytrac vmod=npt10-z30.vmod srfile=jcdint.sc rcfile=jcdint.rc phases="SP FS" level=twop format="X T" dtau=0.1 mdacc=0.5 mindist=0.1 maxitertp=25 ray=npt10-z30.ry... (0 Replies)
Discussion started by: kristinu
0 Replies
reptyr(1)						      General Commands Manual							 reptyr(1)

NAME
reptyr - Reparent a running program to a new terminal SYNOPSIS
reptyr PID reptyr -l DESCRIPTION
reptyr is a utility for taking an existing running program and attaching it to a new terminal. Started a long-running process over ssh, but have to leave and don't want to interrupt it? Just start a screen, use reptyr to grab it, and then kill the ssh session and head on home. reptyr works by attaching to the target program using ptrace(2), redirecting relevant file descriptors, and changing the program's controlling terminal (See tty(4)) It is this last detail that makes rep- tyr work much better than alternatives such as retty(1). After attaching a program, the program will appear to be either backgrounded or suspended to the shell it was launched from (depending on the shell). For maximal safety you can run bg; disown in the old shell to remove the association with the program, but reptyr will attempt to ensure that the target program remains running even if you close the shell without doing so. OPTIONS
-l Instead of attaching to a new process, create a new pty pair, proxy the master end to the current terminal, and then print the name of the slave pty. This can be passed to e.g. gdb's set inferior-tty option. -s By default, reptyr will move any file descriptors in the target that were connected to the target's controlling terminal to point to the new terminal. The -s option will cause reptyr to unconditionally attach file descriptors 0, 1, and 2 in the target, even if the target has no controlling terminal or they are not connected to a terminal. -v Print the version of reptyr and exit. -h Print a usage message and exit. NOTES
reptyr depends on the ptrace(2) system call to attach to the remote program. On Ubuntu Maverick and higher, this ability is disabled by default for security reasons. You can enable it temporarily by doing # echo 0 > /proc/sys/kernel/yama/ptrace_scope as root, or permanently by editing the file /etc/sysctl.d/10-ptrace.conf, which also contains more information about this setting. BUGS
When attaching to some curses programs, they will not redraw the screen right away, and a ^L or similar will be needed to force a redraw. Similarly, after attaching to certain programs, the old terminal will be left in an odd state, and a clear or even reset may be required before the old terminal is usable again. Attaching to rtorrent (and probably some other apps) doesn't work right (rtorrent stops accepting input) (The problem is that rtorrent is using epoll to poll stdin, and we don't update the internal reference that the epoll fd has to the old tty). Attaching to a process with children doesn't work right. This should be possible to fix -- I just need to ptrace each child individually and do the same games to it. Attaching a less(1) process doesn't work if you have a .lessfilter file, as less leaves around a zombie child in this case. This could be worked around. Bugs should be reported to the author (see below) or via the issue tracker on GitHub. AUTHORS
reptyr was written by Nelson Elhage <nelhage@nelhage.com>. HOMEPAGE
<https://github.com/nelhage/reptyr> SEE ALSO
neercs(1), screen(1) 03 Feb 2011 reptyr(1)
All times are GMT -4. The time now is 11:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy