Changes

426 bytes added ,  11:30, 12 April 2013
Line 1: Line 1:  
= Dumping a simplest process in a new session without controll terminal =
 
= Dumping a simplest process in a new session without controll terminal =
 +
At first let's dump/restore a trivial process without external dependences.
 +
* For that we can create a shell script, which will report date and time every second. For removing dependences on a current terminal it will be executed in a new session and output will be redirected in a file.
 
  $ cat > test.sh <<-EOF
 
  $ cat > test.sh <<-EOF
 
  #!/bin/sh
 
  #!/bin/sh
Line 13: Line 15:  
  [2]+  Done                    setsid ./test.sh < /dev/null &>test.log
 
  [2]+  Done                    setsid ./test.sh < /dev/null &>test.log
   −
 
+
* Get pid of the test process:
 
  $  ps -C test.sh
 
  $  ps -C test.sh
 
   PID TTY          TIME CMD
 
   PID TTY          TIME CMD
 
  2221 ?        00:00:00 test.sh
 
  2221 ?        00:00:00 test.sh
 +
* Dump the test process.
 
  $  ~/crtools/crtools dump -t 2221 -vvv -o dump.log && echo OK
 
  $  ~/crtools/crtools dump -t 2221 -vvv -o dump.log && echo OK
 
  OK
 
  OK
 +
* The state of the processes are saved in a few files:
 
  $  ls
 
  $  ls
 
  core-2221.img  eventpoll-tfd.img  filelocks-2221.img  inotify.img      netlinksk.img    pipes.img        sigacts-2424.img  test.log
 
  core-2221.img  eventpoll-tfd.img  filelocks-2221.img  inotify.img      netlinksk.img    pipes.img        sigacts-2424.img  test.log
Line 27: Line 31:  
  eventfd.img    fifo-data.img      ids-2424.img        mm-2221.img      pages-2.img      rlimit-2424.img  signal-s-2424.img  vmas-2221.img
 
  eventfd.img    fifo-data.img      ids-2424.img        mm-2221.img      pages-2.img      rlimit-2424.img  signal-s-2424.img  vmas-2221.img
 
  eventpoll.img  fifo.img          inetsk.img          mm-2424.img      pipes-data.img    sigacts-2221.img  sk-queues.img      vmas-2424.img
 
  eventpoll.img  fifo.img          inetsk.img          mm-2424.img      pipes-data.img    sigacts-2221.img  sk-queues.img      vmas-2424.img
 
+
* Restore the test process.
 
  $ ~/crtools/crtools restore -d -t 2221 -vvv -o restore.log && echo OK
 
  $ ~/crtools/crtools restore -d -t 2221 -vvv -o restore.log && echo OK
 
  OK
 
  OK