forked from engineering/cloudservices
push fix
parent
4bfee04aa2
commit
ba0ac57000
|
@ -20,7 +20,7 @@ export default class SystemD_Restart extends Command {
|
|||
message.delete();
|
||||
return this.success(message.channel, 'Service restarted.');
|
||||
} 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());
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
|
@ -20,7 +20,7 @@ export default class SystemD_Start extends Command {
|
|||
message.delete();
|
||||
return this.success(message.channel, 'Service started.');
|
||||
} 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());
|
||||
}
|
||||
} 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]);
|
||||
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.');
|
||||
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]}'`);
|
||||
if (cmd.includes('could not be found')) return this.error(message.channel, 'The service name you provided doesn\'t exist.');
|
||||
let cmd: string;
|
||||
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();
|
||||
embed.setTitle(`SystemD Status | ${args[0]}`);
|
||||
embed.setDescription(`\`\`\`sh\n${cmd}\n\`\`\``);
|
||||
|
|
|
@ -20,7 +20,7 @@ export default class SystemD_Stop extends Command {
|
|||
message.delete();
|
||||
return this.success(message.channel, 'Service stopped.');
|
||||
} 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());
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue