ubuntu resolute
This commit is contained in:
32
nodejs/commande/utils.js
Normal file
32
nodejs/commande/utils.js
Normal file
@@ -0,0 +1,32 @@
|
||||
const { exec } = require('child_process');
|
||||
|
||||
function executeCommand(cmd) {
|
||||
return new Promise((resolve, reject) => {
|
||||
exec(cmd, (error, stdout, stderr) => {
|
||||
if (error) {
|
||||
reject(`Error executing command: ${cmd}\n${stderr}`);
|
||||
} else {
|
||||
resolve(stdout);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
async function setPermissions(repo) {
|
||||
try {
|
||||
const svnReposPath = `/var/svn/${repo}`;
|
||||
const chmodCmd = `chmod -R 775 ${svnReposPath}`;
|
||||
const chownCmd = `chown -R www-data:www-data ${svnReposPath}`;
|
||||
|
||||
await executeCommand(chmodCmd);
|
||||
await executeCommand(chownCmd);
|
||||
|
||||
console.log('Permissions updated successfully.');
|
||||
} catch (error) {
|
||||
console.error('Error setting permissions:', error);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setPermissions,
|
||||
};
|
||||
Reference in New Issue
Block a user