The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/rocketchat-lib/server/methods/restartServer.js

26 lines
616 B

Meteor.methods({
restart_server() {
if (!Meteor.userId()) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'restart_server' });
}
if (RocketChat.authz.hasRole(Meteor.userId(), 'admin') !== true) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', { method: 'restart_server' });
}
Meteor.setTimeout(() => {
Meteor.setTimeout(() => {
console.warn('Call to process.exit() timed out, aborting.');
process.abort();
}
, 1000);
process.exit(1);
}
, 1000);
return {
message: 'The_server_will_restart_in_s_seconds',
params: [2]
};
}
});