Renaming systemd service

I have multiple instances of ghost 3.x running on an 18.04 Ubuntu server and I’m looking to rename the systemd services without ghost-cli breaking. I’ve compiled a list of steps that I hope someone who understands the innards of ghost-cli can validate will work:

  1. sudo systemctl stop
  2. Edit ~/.ghost/config and change the names in the JSON.
  3. Edit the .ghost-cli file in working directory of each ghost instance with the same names.
  4. Rename the file in /system/files/.service to the new name.
  5. Rename the links in /etc/systemd/system to match what you did above.
  6. sudo systemctl reload-daemon
  7. systemctl start for each newly named ghost instance

Why am I doing this?

  • I’m tired of typing: systemctl stop ghost_blogname-tld-com
  • One of them is named funky because I didn’t have the config url setup properly

Did I miss anything and/or is there an easier way to do this? TIA!

Why not create a bash script to start/ stop/ restart/ check status of each site?

This is interesting.

I don’t have the skills to verify your pipeline, or to set up a bash script.

I have been looking at using PM2 for a while, but haven’t gotten around to testing that. It might be viable for the command line, not sure if it has batch start/stop. -Otherwise it also has a web GUI to connect to the node PM2 instance with their free tier. Anyone w/ experience using PM2?

Best of luck, pls post results.

Cheers!

Instead of renaming the service? Yeah. I could do that, but that’s no fun. It’s also good hygiene if I decide to install more instances and need to move things around.

1 Like