You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.4 KiB
44 lines
1.4 KiB
<?php
|
|
Configure::set('display', true); // Show Output
|
|
Configure::set('logfile', false); // Save to log folder
|
|
Configure::set('syslog', false);
|
|
Configure::set('passwords', ['length' => rand(16, 26)]);
|
|
|
|
Configure::set('pre_actions', [
|
|
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
|
|
'makeDir' => [$cwd . '/my_vaults'=>'', '/etc/neato_secrets'=>''],
|
|
'chmodFileOrDir' =>
|
|
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
|
|
[ $cwd . '/my_vaults' => 'keydir', '/etc/neato_secrets' => 'keydir' ],
|
|
]);
|
|
|
|
forceRoot();
|
|
|
|
//doCommand('service', 'mysql', 'stop');
|
|
|
|
fileLoop(Configure::get('pre_actions'));
|
|
|
|
$my_key = Enc::makeKeyFile("/etc/neato_secrets/mysql_key");
|
|
|
|
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
|
|
if (!file_exists($cwd . "/my_vaults/mysql_secrets")) {
|
|
$root_password = makePassword(Configure::get('passwords', 'length'));
|
|
$obj = new stdClass();
|
|
$obj->root = $root_password;
|
|
|
|
/** @phpstan-ignore-next-line Variable $cwd might not be defined */
|
|
Enc::encodeFile($cwd . "/my_vaults/mysql_secrets", $obj, $my_key);
|
|
}
|
|
|
|
|
|
//$my_key = read_file("/etc/neato_secrets/mysql_data");
|
|
//$o = Enc::decodeFile($cwd . "/my_vaults/my_secrets", $my_key);
|
|
//echo $o->root;
|
|
|
|
//doCommand('service', 'mysql', 'start');
|
|
$ret = doCommand('service', 'mysql', 'status');
|
|
if ($ret === 0) {
|
|
echo "Status Running ;-)";
|
|
} else {
|
|
echo "Status Not Running!";
|
|
} |