本文整理汇总了PHP中lxshell_return函数的典型用法代码示例。如果您正苦于以下问题:PHP lxshell_return函数的具体用法?PHP lxshell_return怎么用?PHP lxshell_return使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lxshell_return函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setMysqlOptimize
function setMysqlOptimize($select, $database = null)
{
global $gbl, $sgbl, $login, $ghtml;
log_cleanup("Mysql Optimization");
$database = $database ? $database : "_all_";
$pass = slave_get_db_pass();
if ($select === 'repair') {
log_cleanup("- Repairing database");
if ($database === '_all_') {
system("mysqlcheck --user=root --password=\"{$pass}\" --repair --all-databases");
} else {
system("mysqlcheck --user=root --password=\"{$pass}\" --repair --databases {$dbname}");
}
} else {
if ($select === 'optimize') {
log_cleanup("- Compacting database");
if ($database === '_all_') {
system("mysqlcheck --user=root --password=\"{$pass}\" --optimize --all-databases");
} else {
system("mysqlcheck --user=root --password=\"{$pass}\" --optimize --databases {$dbname}");
}
}
}
log_cleanup("- MySQL Service restart");
$ret = lxshell_return("service", "mysqld", "restart");
if ($ret) {
throw new lxexception('mysqld_restart_failed', 'parent');
}
}
示例2: updateSwitchProgram
function updateSwitchProgram($param)
{
global $gbl, $sgbl, $login, $ghtml;
if_demo_throw_exception('switchprog');
$this->web_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'web');
$this->dns_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'dns');
$this->spam_driver = $gbl->getSyncClass($this->__masterserver, $this->nname, 'spam');
$a['web'] = $this->web_driver;
$a['dns'] = $this->dns_driver;
$a['spam'] = $this->spam_driver;
foreach ($param as $k => $v) {
if ($this->{$k} === $v) {
dprint("No change for {$k}: {$v}\n");
} else {
$class = strtilfirst($k, "_");
$drstring = "{$class}_driver";
rl_exec_get(null, $this->nname, array($class, 'switchDriver'), array($class, $this->{$drstring}, $v));
changeDriver($this->nname, $class, $v);
$fixc = $class;
if ($class === 'spam') {
$fixc = "mmail";
}
lxshell_return("__path_php_path", "../bin/fix/fix{$fixc}.php", "--server={$this->nname}");
$a[$class] = $v;
rl_exec_get(null, $this->nname, 'slave_save_db', array('driver', $a));
}
}
}
示例3: installMe
static function installMe()
{
global $gbl, $sgbl, $login, $ghtml;
$ret = lxshell_return("yum", "-y", "install", "lighttpd", "lighttpd-fastcgi");
if ($ret) {
throw new lxexception('install_lighttpd_failed', 'parent');
}
lxshell_return("chkconfig", "lighttpd", "on");
lxfile_mkdir("/etc/lighttpd/");
//-- old structure
lxfile_rm("/etc/lighttpd/conf/kloxo");
//-- new structure
$path = "/home/lighttpd/conf";
$list = array("defaults", "domains", "redirects", "webmails", "wildcards", "exclusive");
foreach ($list as $k => $l) {
if (!lxfile_exists("{$path}/{$l}")) {
lxfile_mkdir("{$path}/{$l}");
}
}
lxfile_cp("/usr/local/lxlabs/kloxo/file/lighttpd/lighttpd.conf", "/etc/lighttpd/lighttpd.conf");
$cver = "###version0-7###";
$fver = file_get_contents("/etc/lighttpd/conf.d/~lxcenter.conf");
if (stristr($fver, $cver) === FALSE) {
lxfile_cp("/usr/local/lxlabs/kloxo/file/lighttpd/~lxcenter.conf", "/etc/lighttpd/conf.d/~lxcenter.conf");
}
lxfile_cp("../file/lighttpd/etc_init.d", "/etc/init.d/lighttpd");
lxfile_unix_chmod("/etc/init.d/lighttpd", "0755");
lxfile_unix_chmod("/etc/init.d/lighttpd", "0755");
lxfile_mkdir("/home/kloxo/httpd/lighttpd");
lxfile_unix_chown("/home/kloxo/httpd/lighttpd", "apache");
createRestartFile("lighttpd");
}
示例4: dbactionUpdate
function dbactionUpdate($subaction)
{
global $gbl, $sgbl, $login, $ghtml;
$dir = $this->main->__var_full_directory;
$dir = expand_real_root($dir);
switch ($subaction) {
case "full_update":
$pass = $this->main->realpass;
lxshell_input("{$pass}\n{$pass}\n", "pure-pw", "passwd", $this->main->nname, "-m");
lxshell_return("pure-pw", "usermod", $this->main->nname, "-d", $dir, "-m");
$this->toggleStatus();
$this->setQuota();
break;
case "password":
$pass = $this->main->realpass;
lxshell_input("{$pass}\n{$pass}\n", "pure-pw", "passwd", $this->main->nname, "-m");
break;
case "toggle_status":
$this->toggleStatus();
break;
case "edit":
lxshell_return("pure-pw", "usermod", $this->main->nname, "-d", $dir, "-m");
$this->setQuota();
break;
case "changeowner":
lxshell_return("pure-pw", "usermod", $this->main->nname, "-u", $this->main->__var_username, "-d", $dir, "-m");
break;
}
}
示例5: installMe
static function installMe()
{
global $gbl, $sgbl, $login, $ghtml;
$ret = lxshell_return("yum", "-y", "install", "httpd", "mod_ssl");
if ($ret) {
throw new lxexception('install_httpd_failed', 'parent');
}
lxshell_return("chkconfig", "httpd", "on");
$cver = "###version0-6###";
$fver = file_get_contents("/etc/httpd/conf.d/~lxcenter.conf");
if (stristr($fver, $cver) === FALSE) {
lxfile_cp("/usr/local/lxlabs/kloxo/file/apache/~lxcenter.conf", "/etc/httpd/conf.d/~lxcenter.conf");
}
lxfile_cp("/usr/local/lxlabs/kloxo/file/centos-5/httpd.conf", "/etc/httpd/conf/httpd.conf");
// MR -- old structure
lxfile_rm("/etc/httpd/conf/kloxo");
lxfile_rm("/home/httpd/conf");
// MR -- new structure
$path = "/home/apache/conf";
$list = array("defaults", "domains", "redirects", "webmails", "wildcards", "exclusive");
foreach ($list as $k => $l) {
if (!lxfile_exists("{$path}/{$l}")) {
lxfile_mkdir("{$path}/{$l}");
}
}
// MR -- some vps include /etc/httpd/conf.d/swtune.conf
lxfile_rm("/etc/httpd/conf.d/swtune.conf");
// issue #527
lxfile_cp("../file/apache/etc_init.d", "/etc/init.d/httpd");
lxshell_return("{$sgbl->__path_php_path}", "../bin/misc/installsuphp.php");
createRestartFile("apache");
}
示例6: checkService
static function checkService($name)
{
$servicepath = "__path_real_etc_root/init.d";
$ret = lxshell_return("{$servicepath}/{$name}", "status");
$state = $ret ? "off" : "on";
return $state;
}
示例7: getServiceDetails
static function getServiceDetails($list)
{
$ps = lxshell_output("ps", "ax");
$run = Service__linux::getRunLevel();
$rclist = lscandir_without_dot("__path_real_etc_root/rc{$run}.d/");
foreach ($list as &$__l) {
$__l['install_state'] = 'dull';
$__l['state'] = 'off';
$__l['boot_state'] = 'off';
if (lxfile_exists("__path_real_etc_root/init.d/{$__l['servicename']}")) {
$__l['install_state'] = 'on';
} else {
continue;
}
if (self::checkServiceInRc($rclist, $__l['servicename'])) {
$__l['boot_state'] = 'on';
}
if ($__l['grepstring']) {
if (preg_match("/[\\/ ]{$__l['grepstring']}/i", $ps)) {
$__l['state'] = 'on';
}
} else {
$ret = lxshell_return("/etc/init.d/{$__l['servicename']}", "status");
if ($ret) {
$__l['state'] = 'off';
} else {
$__l['state'] = 'on';
}
}
}
return $list;
}
示例8: dbactionUpdate
function dbactionUpdate($subaction)
{
if_demo_throw_exception('lxguard');
$rmt = new Remote();
$rmt->data['disablehit'] = $this->main->disablehit;
lfile_put_serialize("__path_home_root/lxguard/config.info", $rmt);
lxshell_return("__path_php_path", "../bin/common/lxguard.php");
}
示例9: dosyncToSystemPost
function dosyncToSystemPost()
{
global $sgbl;
$ret = lxshell_return("rndc", "reload");
if ($ret) {
createRestartFile("bind");
}
}
示例10: doUpdate
static function doUpdate($list)
{
$cmd = self::getYumCommand();
$file = fix_nname_to_be_variable($cmd);
$file = "__path_program_root/cache/{$file}";
lxshell_return("yum", "-y", "install", implode(" ", $list));
lunlink($file);
}
示例11: updatecleanup_main
function updatecleanup_main()
{
global $argc, $argv;
global $gbl, $sgbl, $login, $ghtml;
$program = $sgbl->__var_program_name;
$opt = parse_opt($argv);
if ($opt['type'] === 'master') {
initProgram('admin');
$flg = "__path_program_start_vps_flag";
if (!lxfile_exists($flg)) {
set_login_skin_to_feather();
}
} else {
$login = new Client(null, null, 'update');
}
print "Executing UpdateCleanup. This can take a long time. Please be patient\n";
log_log("update", "Executing Updatecleanup");
//
// Cleanup old lxlabs.repo file
//
print "Fixing Repo's\n";
if (lxfile_exists("/etc/yum.repos.d/lxcenter.repo")) {
if (lxfile_exists("/etc/yum.repos.d/lxlabs.repo")) {
lxfile_mv("/etc/yum.repos.d/lxlabs.repo", "/etc/yum.repos.d/lxlabs.repo.lxsave");
system("rm -f /etc/yum.repos.d/lxlabs.repo");
}
}
if (lxfile_exists("CVS")) {
print "Found Development version, we just go on.\n";
// exit;
}
if ($opt['type'] === 'master') {
$sgbl->slave = false;
if (!is_secondary_master()) {
print "Update database\n";
updateDatabaseProperly();
print "Fix Extra database issues\n";
fixExtraDB();
print "Update extra issues\n";
doUpdateExtraStuff();
print "Get Driver info\n";
lxshell_return("__path_php_path", "../bin/common/driverload.php");
}
print "Starting Update all slaves\n";
update_all_slave();
print "Fix main {$program} databasefile\n";
cp_dbfile();
} else {
$sgbl->slave = true;
}
if (!is_secondary_master()) {
print "Starting update cleanups\n";
updatecleanup();
}
lxfile_touch("__path_program_start_vps_flag");
}
示例12: updateWht
function updateWht()
{
$res = $this->main->__var_whitelist;
$res = merge_array_object_not_deleted($res, $this->main);
$list = get_namelist_from_arraylist($res, 'ipaddress');
$rmt = new Remote();
$rmt->data = $list;
lfile_put_serialize("__path_home_root/lxguard/whitelist.info", $rmt);
lxshell_return("__path_php_path", "../bin/common/lxguard.php");
}
示例13: create_dev
function create_dev()
{
if (lxfile_exists("/sbin/udevd")) {
lxfile_mv("/sbin/udevd", "/sbin/udevd.back");
}
lxshell_return('tar', '-C', '/dev', '-xzf', '../file/centos-5/vps-dev.tgz');
lxshell_return('/sbin/MAKEDEV', 'pty');
lxshell_return('/sbin/MAKEDEV', 'tty');
lxshell_return('/sbin/MAKEDEV', 'loop');
lxshell_return('/sbin/MAKEDEV', 'random');
lxshell_return('/sbin/MAKEDEV', 'urandom');
}
示例14: shellModify
function shellModify()
{
global $gbl, $sgbl, $login, $ghtml;
if_demo_throw_exception();
$shell = fix_disabled($this->main->shell, $sgbl->__var_noaccess_shell);
lxshell_return("usermod", "-s", $shell, $this->main->nname);
if ($this->main->isOn('disable_system_flag')) {
lxshell_return("usermod", "-L", $this->main->nname);
} else {
lxshell_return("usermod", "-U", $this->main->nname);
}
}
示例15: create_main
function create_main()
{
global $argc, $argv;
global $gbl, $sgbl, $login, $ghtml;
$opt = parse_opt($argv);
if (file_exists('/usr/local/lxlabs/.git')) {
$opt['development_found'] = '1';
}
lxfile_mkdir("{$sgbl->__path_program_etc}/conf");
lxfile_mkdir("{$sgbl->__path_program_root}/pid");
lxfile_mkdir("{$sgbl->__path_program_root}/log");
lxfile_mkdir("{$sgbl->__path_httpd_root}");
os_create_program_service();
if (isset($opt['admin-password'])) {
$admin_pass = $opt['admin-password'];
} else {
$admin_pass = 'admin';
}
if ($opt['install-type'] == 'master') {
if (!isset($opt['development_found'])) {
create_mysql_db('master', $opt, $admin_pass);
create_database();
create_general();
add_admin($admin_pass);
create_servername();
lxshell_return("__path_php_path", "../bin/collectquota.php");
} else {
print "Development GIT version found. Skipping creation from scratch of HyperVM-NG.\n";
}
print "Updating the system. Will take a while\n";
system("/usr/local/lxlabs/ext/php/php ../bin/common/updatecleanup-main.php --type=master");
} else {
if ($opt['install-type'] == 'slave') {
if (!isset($opt['development_found'])) {
init_slave($admin_pass);
} else {
print "Development GIT version found. Skipping creation from scratch of HyperVM-NG.\n";
}
print "Updating the system. Will take a while\n";
system("/usr/local/lxlabs/ext/php/php ../bin/common/updatecleanup-main.php --type=slave");
} else {
print "Unknown Install type\n";
flush();
}
}
system("rm -f /etc/sysconfig/network-scripts/ifcfg-*-range*");
//system("$sgbl->__path_php_path ../bin/misc/fixcentos5xen.php");
//os_fix_some_permissions();
system("cp ../sbin/lxxen ../sbin/lxopenvz /usr/bin");
system("chmod 4755 /usr/bin/lxxen /usr/bin/lxopenvz");
//os_set_iis_ftp_root_path();
}