Trie entre alternc et alternc-lxc

This commit is contained in:
Alan Garcia 2013-04-22 06:49:03 +00:00
parent 9d6374fd8b
commit a98688768a
4 changed files with 0 additions and 107 deletions

3
.gitattributes vendored
View File

@ -497,7 +497,6 @@ etc/alternc/templates/postfix/sasl/smtpd.conf -text
etc/alternc/templates/proftpd/modules.conf -text
etc/alternc/templates/proftpd/proftpd.conf -text
etc/alternc/templates/proftpd/welcome.msg -text
etc/xinetd.d/alternc_lxc -text
install/alternc.install -text
install/body_checks -text
install/domaines.template -text
@ -586,7 +585,6 @@ src/alternc-check -text
src/alternc-dboptimize -text
src/alternc-passwd -text
src/alternc_add_policy_dovecot -text
src/alternc_lxc_remote -text
src/alternc_reload -text
src/compress_logs.sh -text
src/courier-dovecot-migrate.pl -text
@ -625,7 +623,6 @@ 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

View File

@ -1,16 +0,0 @@
service alternc_lxc
{
type = UNLISTED
port = 6504
socket_type = stream
protocol = tcp
wait = no
user = root
server = /var/lib/alternc-lxc/alternc_lxc_remote
only_from = 127.0.0.1
disable = no
}

View File

@ -1,8 +0,0 @@
#!/usr/bin/env perl
my $line = <>;
my ($action,$login,$pass,$uid) = split /\|/, $line;
my @command = ('alternc_lxc', $action, $login, $pass, $uid);
system (@command);

View File

@ -1,80 +0,0 @@
#!/usr/bin/php
<?php
require_once("/var/lib/alternc-lxc/alternc_lxc.class.php");
function help() {
echo "Actions:\n";
echo " * ".$_SERVER['SCRIPT_NAME']." start login password_hash UID\n";
echo " * ".$_SERVER['SCRIPT_NAME']." stop vm\n";
echo " * ".$_SERVER['SCRIPT_NAME']." stopall\n";
echo " * ".$_SERVER['SCRIPT_NAME']." monit\n";
echo " * ".$_SERVER['SCRIPT_NAME']." list\n";
echo " * ".$_SERVER['SCRIPT_NAME']." lock\n";
echo " * ".$_SERVER['SCRIPT_NAME']." unlock\n";
echo "\n";
}
# Must be launched as root
if (shell_exec("/usr/bin/id -u") != 0 ) {
echo "Script must be launch as root.\n";
die();
}
# There must be at least one parameters
if (empty($argv[1])) {
help();
die();
}
$filename = '/etc/alternc-lxc/vms.json';
$conf = json_decode(file_get_contents($filename), TRUE);
$lxc = new alternc_lxc();
$lxc->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();
}
?>