diff --git a/.gitattributes b/.gitattributes index f091d24a..a6605f39 100644 --- a/.gitattributes +++ b/.gitattributes @@ -456,6 +456,7 @@ debian/po/nl.po -text debian/po/pt.po -text debian/po/templates.pot -text debian/rules -text +etc/alternc-lxc/vms.json -text etc/alternc/alternc-sudoers -text etc/alternc/alternc.ini -text etc/alternc/apache2-ssl.conf -text @@ -622,6 +623,7 @@ tests/mechdump.pm -text tests/test_demo.pl -text tests/whois_test.php -text tools/alternc_get_path -text +tools/alternc_lxc -text tools/get_account_by_domain -text tools/get_domains_by_account -text tools/top_ftp_users -text diff --git a/etc/alternc-lxc/vms.json b/etc/alternc-lxc/vms.json new file mode 100644 index 00000000..07fac993 --- /dev/null +++ b/etc/alternc-lxc/vms.json @@ -0,0 +1,24 @@ +{ +"vm1":{ + "hostname":"vm1.test.fr", + "network":{ + "eth0":{ + "link":"brdummy", + "ip":"10.50.0.2\/24" + }, + "eth1":{ + "link":"brdummy2", + "ip":"10.55.0.2\/24" + } + } +}, +"vm2":{ + "hostname":"vm2.test.fr", + "network":{ + "eth0":{ + "link":"brdummy", + "ip":"10.51.0.2\/24" + } + } +} +} diff --git a/tools/alternc_lxc b/tools/alternc_lxc new file mode 100755 index 00000000..a4003f9a --- /dev/null +++ b/tools/alternc_lxc @@ -0,0 +1,80 @@ +#!/usr/bin/php +conf=$conf; + +# Here we go +switch ($argv[1]) { + case "start": + if (empty($argv[2]) || empty($argv[3]) || empty($argv[4])) { + help(); + die(); + } + $r = $lxc->start_vm($argv[2], $argv[3], $argv[4]); + echo serialize($r); + break; + case "stopall": + $r=$lxc->stopall_vm(); + echo serialize($r); + break; + case "stop": + if (empty($argv[2])) { + help(); + die(); + } + $r=$lxc->stop_vm($argv[2]); + echo serialize($r); + break; + case "unlock": + $r=$lxc->unlock(); + echo serialize($r); + break; + case "lock": + $r=$lxc->lock(); + echo serialize($r); + break; + case "monit": + $r=$lxc->monit(); + echo serialize($r); + break; + case "list": + $r=$lxc->listvm(); + echo "$r"; + break; + default: + help(); + die(); +} + +?>