function ssh() { \model\simple\Ssh::supprime("salorium", "/home/salorium/test"); }
$a = \model\simple\Ssh::execute("root", \config\Conf::$rootpassword, 'mkdir -p /home/' . $login . '/rtorrent/data'); if ($a["error"] !== "") { throw new Exception("Erreur : " . $a["error"]); } \model\simple\Console::println('Creation /home/' . $login . '/rtorrent/session'); $a = \model\simple\Ssh::execute("root", \config\Conf::$rootpassword, 'mkdir -p /home/' . $login . '/rtorrent/session'); if ($a["error"] !== "") { throw new Exception("Erreur : " . $a["error"]); } \model\simple\Console::println('Attribution du propriétaire ' . $login . ' /home/' . $login . ''); $a = \model\simple\Ssh::execute("root", \config\Conf::$rootpassword, 'chown -R ' . $login . ':' . $login . ' /home/' . $login); if ($a["error"] !== "") { throw new Exception("Erreur : " . $a["error"]); } \model\simple\Console::println('Ajout de l\'auto start'); $a = \model\simple\Ssh::execute("root", \config\Conf::$rootpassword, 'echo "mount /dev/' . config\Conf::$nomvg . '/' . $login . " /home/" . $login . '" >> /etc/init.d/rtorrentall'); if ($a["error"] !== "") { throw new Exception("Erreur : " . $a["error"]); } $a = \model\simple\Ssh::execute("root", \config\Conf::$rootpassword, 'echo "/etc/init.d/rtorrent \$1 ' . $login . ' "' . $scgi . ' >> /etc/init.d/rtorrentall'); if ($a["error"] !== "") { throw new Exception("Erreur : " . $a["error"]); }*/ \model\simple\Console::println('Lancement de rtorrent'); $a = \model\simple\Ssh::execute("root", \config\Conf::$rootpassword, 'php ' . ROOT . DS . "script" . DS . "startrtorrent.php " . $login . " " . $scgi); if ($a["error"] !== "") { throw new Exception("Erreur : " . $a["error"]); } } else { \model\simple\Console::println(basename(__FILE__) . " <hostmysql> <loginmysql> <passmysql>"); }
function restartApache($pass = null) { if (!is_null($pass)) { $t[] = \model\simple\Ssh::execute("root", $pass, "service apache2 reload"); $this->set(array("result" => $t)); } }