-
Notifications
You must be signed in to change notification settings - Fork 73
/
reredirect.1
164 lines (130 loc) · 2.57 KB
/
reredirect.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
.mso www.tmac
.TH reredirect 1 "26 Aug 2014"
.SH NAME
reredirect \- Tool to dynamically redirect outputs of a running process
.SH SYNOPSIS
.B reredirect [-i
.I FILE
.B |-i
.I FD
.B ] [-m
.I FILE
.B |-o
.I FILE
.B |-e
.I FILE
.B |-I
.I FD
.B |-O
.I FD
.B |-E
.I FD
.B ] [-N] [-d]
.I PID
.SH DESCRIPTION
.B reredirect
is a utility for taking an existing running program and
attaching its input/outputs (standard output and error output) to files or
another process.
Simple usage is:
reredirect -m FILE PID
It will redirect outputs of
.I PID
to
.I FILE.
It is also possible to redirect standard
input, output and error output in different files:
reredirect -i FILE1 -o FILE2 -e FILE3 PID
.B \-m
option is just a shortcut to
.B \-o FILE \-e FILE
After launched, reredirect, give you command to restore state of
.I PID.
It will looks like:
reredirect -N -I 4 -O 5 -E 3 5453
.B \-I
,
.B \-O
and
.B \-E
act as
.B \-i
,
.B \-o
and
.B \-e
but with already opened file descriptors in
.I PID.
They only used to restore previous state of
.I PID.
.SH OPTIONS
.B \-i FILE
.IP
File to redirect stdin
.LP
.B \-o FILE
.IP
File to redirect stdout
.LP
.B \-e FILE
.IP
File to redirect stderr
.LP
.B \-m FILE
.IP
Same than
.B \-o FILE \-e FILE
.LP
.B \-I FD
.IP
Redirect stdin to this file descriptor. Mainly used to restore process input
.LP
.B \-O FD
.IP
Redirect stdout to this file descriptor. Mainly used to restore process outputs
.LP
.B \-E FD
.IP
Redirect stderr to this file descriptor. Mainly used to restore process outputs
.LP
.B \-N
.IP
Do not save previous stream
.LP
.B \-V
.IP
Print the version of
.B reredirect
and exit.
.LP
.B \-h
.IP
Print a usage message and exit.
.LP
.B \-v
.IP
Print verbose debug output while running.
.LP
.SH NOTES
.B reredirect
depends on the
.BR 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
.IP
# echo 0 > /proc/sys/kernel/yama/ptrace_scope
.LP
as root, or permanently by editing the file
.IR /etc/sysctl.d/10-ptrace.conf ,
which also contains more information about this setting.
.SH BUGS
Bugs should be reported to the author (see below) or via the issue tracker on
GitHub.
.SH AUTHORS
reredirect was mainly written by Jérôme Pouiller <[email protected]>. You can
contact hom for any questions or bug reports.
reredirect (and especially all ptrace layer) is based on reptyr programm. reptyr
was written by Nelson Elhage <[email protected]>.
.SH HOMEPAGE
.URL http://github.com/jerome-pouiller/reredirect