feat: auto-sync clones para /root/Desktop/Clonados apos cada clone
This commit is contained in:
@@ -75,6 +75,19 @@ app.post('/api/wget-clone', async (req, res) => {
|
||||
});
|
||||
|
||||
console.log('✅ Wget clone completed successfully');
|
||||
|
||||
// Sync to host /root/Desktop/Clonados
|
||||
if (response.data && response.data.success && response.data.directory) {
|
||||
const { exec } = require('child_process');
|
||||
const containerId = require('os').hostname();
|
||||
const cloneDir = response.data.directory.split('/').pop();
|
||||
const hostDir = '/root/Desktop/Clonados';
|
||||
exec(`docker cp b38l2zsxjv08xkxg4gd5rl9r-210808689309:${response.data.directory} ${hostDir}/ 2>/dev/null`, (err) => {
|
||||
if (err) console.log('⚠️ Sync to host failed:', err.message);
|
||||
else console.log('✅ Clone synced to host:', cloneDir);
|
||||
});
|
||||
}
|
||||
|
||||
res.json(response.data);
|
||||
} catch (error) {
|
||||
console.error('❌ Wget clone error:', error.message);
|
||||
|
||||
Reference in New Issue
Block a user