1

I've started a long running process with nohup and redirected it's output to a log file

Example:

nohup ./bin/zkServer.sh start-foreground > /usr/local/myuser/logs/zkout.log 2>&1 &

I accidentally deleted the zkout.log file so now I can't see any output from the command.

I'm not interested in recovering the data, but I am wondering if there is a way to 'reattach' the stdout from my long running process to the file without having to kill/restart?

I tried just recreating /usr/local/myuser/logs/zkout.log but that doesn't work.

I also looked at this question: recovering deleted file held open by apache? but that is talking about recovering the content of the deleted file (which I don't care about). However, I do see the broken link in /proc/$procid/fd; could I just update that link to point to the new file?

FGreg
  • 135
  • How good are you with gdb ? – thrig Apr 21 '16 at 16:58
  • @thrig never used it. If there's not an easy way to do it I'll have to kill and restart; not a huge deal just thought there might be something simple I didn't know about. – FGreg Apr 21 '16 at 17:02
  • 2
    I believe what you're looking for is answered here http://unix.stackexchange.com/questions/92816/can-a-file-be-retrieved-by-its-inode – SeeJayEmm Apr 21 '16 at 19:18

0 Answers0