forked from engineering/cloudservices
push fix
parent
4bfee04aa2
commit
ba0ac57000
|
@ -20,7 +20,7 @@ export default class SystemD_Restart extends Command {
|
||||||
message.delete();
|
message.delete();
|
||||||
return this.success(message.channel, 'Service restarted.');
|
return this.success(message.channel, 'Service restarted.');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.includes('not found')) return this.error(message.channel, 'Service not found.');
|
if (err.toString().includes('could not be found')) return this.error(message.channel, 'Service not found.');
|
||||||
return this.error(message.channel, err.toString());
|
return this.error(message.channel, err.toString());
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default class SystemD_Start extends Command {
|
||||||
message.delete();
|
message.delete();
|
||||||
return this.success(message.channel, 'Service started.');
|
return this.success(message.channel, 'Service started.');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.includes('not found')) return this.error(message.channel, 'Service not found.');
|
if (err.toString().includes('could not be found')) return this.error(message.channel, 'Service not found.');
|
||||||
return this.error(message.channel, err.toString());
|
return this.error(message.channel, err.toString());
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
|
@ -15,8 +15,12 @@ export default class SystemD_Status extends Command {
|
||||||
if (!args[0]) return this.client.commands.get('help').run(message, ['systemd', this.name]);
|
if (!args[0]) return this.client.commands.get('help').run(message, ['systemd', this.name]);
|
||||||
const account = await this.client.db.Account.findOne({ userID: message.author.id }).lean().exec();
|
const account = await this.client.db.Account.findOne({ userID: message.author.id }).lean().exec();
|
||||||
if (!account) return this.error(message.channel, 'You do not have a Cloud Services account.');
|
if (!account) return this.error(message.channel, 'You do not have a Cloud Services account.');
|
||||||
const cmd = await this.client.util.exec(`runuser ${account.username} -c 'DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/\${UID}/bus" systemctl --user status ${args[0]}'`);
|
let cmd: string;
|
||||||
if (cmd.includes('could not be found')) return this.error(message.channel, 'The service name you provided doesn\'t exist.');
|
try {
|
||||||
|
cmd = await this.client.util.exec(`runuser ${account.username} -c 'DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/\${UID}/bus" systemctl --user status ${args[0]}'`);
|
||||||
|
} catch (err) {
|
||||||
|
if (err.toString().includes('could not be found')) return this.error(message.channel, 'The service name you provided doesn\'t exist.');
|
||||||
|
}
|
||||||
const embed = new RichEmbed();
|
const embed = new RichEmbed();
|
||||||
embed.setTitle(`SystemD Status | ${args[0]}`);
|
embed.setTitle(`SystemD Status | ${args[0]}`);
|
||||||
embed.setDescription(`\`\`\`sh\n${cmd}\n\`\`\``);
|
embed.setDescription(`\`\`\`sh\n${cmd}\n\`\`\``);
|
||||||
|
|
|
@ -20,7 +20,7 @@ export default class SystemD_Stop extends Command {
|
||||||
message.delete();
|
message.delete();
|
||||||
return this.success(message.channel, 'Service stopped.');
|
return this.success(message.channel, 'Service stopped.');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err.includes('not found')) return this.error(message.channel, 'Service not found.');
|
if (err.toString().includes('not found')) return this.error(message.channel, 'Service not found.');
|
||||||
return this.error(message.channel, err.toString());
|
return this.error(message.channel, err.toString());
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in New Issue