26 lines
739 B
JavaScript
26 lines
739 B
JavaScript
const { exec } = require('child_process');
|
|
const { promisify } = require('util');
|
|
const execAsync = promisify(exec);
|
|
|
|
async function test() {
|
|
const cmd = `/root/.acme.sh/acme.sh --issue --dns -d "*.cnbugs.top" -d "cnbugs.top" --server letsencrypt --yes-I-know-dns-manual-mode-enough-go-ahead-please --force 2>&1`;
|
|
|
|
console.log('执行命令:', cmd);
|
|
|
|
try {
|
|
const { stdout, stderr } = await execAsync(cmd, {
|
|
env: { ...process.env, HOME: '/root' },
|
|
shell: '/bin/bash'
|
|
});
|
|
|
|
console.log('stdout:', stdout);
|
|
console.log('stderr:', stderr);
|
|
} catch (error) {
|
|
console.log('错误:', error.message);
|
|
console.log('stdout:', error.stdout);
|
|
console.log('stderr:', error.stderr);
|
|
}
|
|
}
|
|
|
|
test();
|