Improve the experience for Linux users by letting them run the OSX pm2 configuration, but tell them they should just run it with systemctl.

main
Zed A. Shaw 2 years ago
parent 9671419da7
commit fff3bff489
  1. 15
      commands/devsvc.js
  2. 2
      scripts/osx.config.cjs

@ -7,7 +7,7 @@ export const options = [
['--stop', `Stop the ${process.platform} OS services.`],
['--start', `Start the ${process.platform} OS services (the default).`],
['--noexit', `When used in other commands, don't call process.exit.`],
['--os', 'Force the process.platform to specific one']
['--os <platform>', 'Force the process.platform to specific one']
]
const windows = (opts) => {
@ -20,10 +20,6 @@ const windows = (opts) => {
}
}
const linux = (opts) => {
console.error("ERROR: linux isn't supported yet. Sorry!");
}
const darwin = (opts) => {
if(opts.stop) {
console.log("Stopping pm2...");
@ -35,6 +31,15 @@ const darwin = (opts) => {
}
}
const linux = (opts) => {
if(opts.os === "linux") {
darwin(opts);
} else {
console.error("On Linux you should run redis-server using systemctl or similar. If you really want to use pm2 to manage redis then rerun this command with: --os linux");
process.exit(1);
}
}
export const main = (opts) => {
const platform = opts.os ? opts.os : process.platform;

@ -2,7 +2,7 @@ module.exports = {
apps: [
{
name: 'redis',
script: '/usr/local/bin/redis-server --dir /tmp',
script: 'redis-server --dir /tmp',
instances: 1,
autorestart: false,
watch: false,

Loading…
Cancel
Save