CRIU, Checkpoint Restart In Userspace for Linux, binding for mruby.
- add conf.gem line to
build_config.rb
MRuby::Build.new do |conf|
# ... (snip) ...
conf.gem :git => 'https://github.com/matsumoto-r/mruby-criu.git'
end
#!/bin/bash
cont=0
while :; do
sleep 1
cont=`expr $cont + 1`
echo $cont
done
setsid ./loop.sh < /dev/null &> loop_log.txt &
ps -C loop.sh
PID TTY TIME CMD
4823 ? 00:00:00 loop.sh
[1]+ Done setsid ./loop.sh < /dev/null &>loop_log.txt
tail -f loop_log.txt
1
2
3
...
socket = "/var/run/criu_service.socket"
images = "/tmp/dump_test"
log = "dump.log"
pid = 4823
c = CRIU.new
c.set_pid pid
c.set_images_dir images
c.set_service_address socket
c.set_log_file log
c.dump
./bin/mruby dump.rb
then, loop.sh
was killed.
tail -f loop_log.txt
1
2
3
(stopped)
socket = "/var/run/criu_service.socket"
images = "/tmp/dump_test"
log = "restore.log"
c = CRIU.new
c.set_service_address socket
c.set_images_dir images
c.set_log_file log
c.restore
./bin/mruby restore.rb
then, loop.sh was restored
tail -f loop_log.txt
(restored)
4
5
6
...
under the MIT License:
- see LICENSE file