From fff3bff489090bfdcad61132f1445912ea1e53ff Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Tue, 17 Jan 2023 05:00:29 +0400 Subject: [PATCH] Improve the experience for Linux users by letting them run the OSX pm2 configuration, but tell them they should just run it with systemctl. --- commands/devsvc.js | 15 ++++++++++----- scripts/osx.config.cjs | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/commands/devsvc.js b/commands/devsvc.js index f357669..d12d0b1 100644 --- a/commands/devsvc.js +++ b/commands/devsvc.js @@ -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 ', '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; diff --git a/scripts/osx.config.cjs b/scripts/osx.config.cjs index 4127bbe..1771230 100644 --- a/scripts/osx.config.cjs +++ b/scripts/osx.config.cjs @@ -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,