Score:2

Cannot kill redis server. It restarts every time I kill it

mc flag

I cannot kill redis-server no matter how many times I've tried.

ps -ef | grep redis-server gives

root 10592 1 0 01:10 ? 00:00:00 /snap/redis/658/usr/bin/redis-server *:6379

root 10846 8813 0 01:12 pts/1 00:00:00 grep --color=auto redis-server

I have tried:

  • Using kill -9 [pid]
  • Using service redis-server stop (in normal user with sudo and while in sudo su - root)
  • Using /etc/init.d/redis-server stop
  • Using redis-cli and then running shutdown SAVE or shutdown NOSAVE in the CLI
  • Using systemctl stop redis-server

No matter what I do, the server just restarts with a different PID. Can somebody tell me what the hell is going on? Yesterday, I never even installed redis on my Ubuntu. Today, after installing redis-cli, suddenly redis runs on boot, and is unkillable. What the hell is going on? How do I kill it? Why does it behave this way?

Note: I'm on Ubuntu 22.

vidarlo avatar
ar flag
It's a snap. If you don't need it you can uninstall it using `sudo snap remove redis-server`.
Shaundavin13 avatar
mc flag
Ok, but why does it keep on restarting when I use snap? What's the reason behind that? Why is it unkillable through snap?
vidarlo avatar
ar flag
Possibly something else that you want depends on it.
Shaundavin13 avatar
mc flag
Hm, not sure that's the case since I just installed it 2 days ago. Anyway, turns out `sudo snap stop redis` finally stops it. Don't know why snap processes are immune to normal kill commands.
Score:1
mc flag

Ok it turns out, snap uses a different system for maintaining processes vs regular systemctl. Snap apparently also allows you to start/stop processes, so you can use sudo snap stop redis to stop the redis server from snap.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.