project-indexer
Version:
Local project indexer with browser trigger support
42 lines (35 loc) • 1.28 kB
JavaScript
/**
* Service uninstallation script for project-indexer
* This script removes project-indexer from PM2 and system startup
*/
import { exec } from 'child_process';
import os from 'os';
console.log('Uninstalling project-indexer background service...');
// Stop and remove the service from PM2
exec('pm2 delete project-indexer', (error, stdout, stderr) => {
if (error) {
console.error(`Error stopping service: ${error.message}`);
console.log('Service might not be running or already uninstalled.');
} else {
console.log('Service stopped and removed from PM2.');
}
// Remove from startup based on OS
const platform = os.platform();
if (platform === 'win32') {
exec('pm2 unstartup windows', (error, stdout, stderr) => {
if (error) {
console.error(`Error removing from Windows startup: ${error.message}`);
} else {
console.log('Service removed from Windows startup.');
}
console.log('Uninstallation complete!');
});
} else {
// For macOS and Linux
console.log('To completely remove from system startup, you may need to run:');
console.log('pm2 unstartup');
console.log('And follow any instructions displayed.');
console.log('Uninstallation complete!');
}
});