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/app/lib/server/methods/restartServer.js

28 lines
686 B

import { Meteor } from 'meteor/meteor';
import { hasRole } from '../../../authorization';
Meteor.methods({
restart_server() {
if (!Meteor.userId()) {
throw new Meteor.Error('error-invalid-user', 'Invalid user', { method: 'restart_server' });
}
if (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],
};
},
});