Thanks nezabudka. Actually a primary script open a text file from vi command. But end user need close the file manually, than only the primary script resumes execute the next flows. Above command helps to save the file even if it open. Is there a way to send ( :wq ) in current active window ?
the command given above writes the open buffer to a disk. So there is no need for an open window to execute command :w.
Do you need to exit vim?
--- Post updated at 16:53 ---
Maybe the solution is if you run a line of code in a script in the background?
And connect to it when necessary
Hi ,
I need to prepare a script which will check my database with specific to particluar table. If the row count exceeds a certain limit, i need to send a mail to a set of Recipients.
Being new to unix, please guide me to complete this task.
Advance thanks,
Sekar. (4 Replies)
Hi all,
I have programmed in VB before, and have recently moved on to Bash.
In VB there is a command:
SendKeys {F12} > "Show Help"
SendKeys {Y} > "Answer Yes"
Is there any way of doing this in Bash? (I need to send the Ctrl key into the script?)
Thanks in advance (3 Replies)
Hi I have written one shell script , using that i am able to connect to remote machine but i have to
#!/usr/bin/expect -f
set address
set username
set password
set OOLpath
set dbusername
set dbpasswd
set tnsname
set recdbusername
set recdbpasswd
set rectnsname
spawn ssh... (1 Reply)
Hi,
I have written one shell script , using that i am able to connect to remote machine but i have to
#!/usr/bin/expect -f
set address
set username
set password
set OOLpath
set dbusername
set dbpasswd
set tnsname
set recdbusername
set recdbpasswd
set rectnsname
spawn ssh... (2 Replies)
Hi All,
I am new to the unix , i have to deliver one script very urgently
I have to write a shell script where i have i want to send email to specific email id
in this script i want
FROM to be parameterized and stored in a variable
TO to be parameterized and stored in a variable... (3 Replies)
Hi all,
I needed a shell script for file transfering using public/private keys for authentication.
Could you please help me out on this?
A procedure to write a shell script is enough.
Thanks in advance.
Regards.
Vidya N (8 Replies)
Hi Guys,
I am very new to shell script and I need your help here to write a script. Actually, I have a script abc.sh which don't get terminated itself. So I need to design a script to run this script, save the output to a file, search for a given string in the output and if it exists send those... (11 Replies)
Discussion started by: Sambit Sahu
11 Replies
LEARN ABOUT DEBIAN
reptyr
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)