kubuntu solves the problem of restarting after exiting Nut Cloud

Phenomenon

After clicking to exit Nutstore on the tray, Nutstore will restart automatically, and the small icon of Nutstore will appear again on the tray

Check the process list and find that the "python3 /home/jianghuixin/.nutstore/dist/bin/nutstore-pydaemon.py" command is always there, without ending

$ ps -ef | grep nutstore

Guess why:

  1. When the Nutstore client exits, it will send the "exit" command to the nutstore-pydaemon.py process, but this process fails
  2. The watchDog thread of the nutstore-pydaemon.py process detected that the client "unexpectedly" exited, restarting the client

solve

The Nutstore GUI client is written in java package, which is inconvenient to modify. You can modify the code in the nutstore-pydaemon.py file, and prohibit the client from restarting in JavaAppWatchDog.runthe function (line 381 of the source code file)

The original code is if restart_num > 10, now changed toif restart_num > 1

# Tell the java client how many times it has been restarted
restart_num = self.inc_and_get_restart_num()
if restart_num > 1:
	logger.warning('We have restarted %d times, so abort it' % restart_num)
	# avoid restarting the java client again and again. The threshold should be
	# larger than the threshold of java client, which is 5 so that java client can detect the
	# problem and notify the user. This should only be triggered when java client is
	# crashed too early, e.g. the gnome/gtk environment is not ready and it can not
	# be initialized
	os._exit(-1)

When the GUI client is started for the first time, the value of restart_num becomes 1, and the value of restart_num becomes 2 before the next attempt to start the client, since it is greater than 1, the process ends

Guess you like

Origin blog.csdn.net/jiang_huixin/article/details/129710408