Sus definiciones de servicio son así:
[Service]
ExecStart=python /home/pi/projects/script1.py
Restart=always
Y este es el mensaje de error en cada uno de ellos:
Executable path is not absolute, ignoring: python /home/pi/...
Para systemd
, el "ejecutable" en esta definición de servicio es python
, y claramente no es una ruta absoluta. El /home/pi/projects/script1.py
es solo un argumento para este python
ejecutable, y el trabajo del ejecutable es cuidar su forma adecuada.
Cualquier variable de entorno específica de Python -como PYTHONPATH
no tiene ningún significado parasystemd
:usted debe darle una ruta absoluta para el ejecutable en la definición del servicio, todas y cada una de las veces.
Por lo general, la ruta absoluta al intérprete de python es /usr/bin/python
, pero puede verificar:
$ type python
python is /usr/bin/python
Entonces sus definiciones de servicio deberían ser así:
[Service]
ExecStart=/usr/bin/python /home/pi/projects/script1.py
Restart=always
Puede encontrar una introducción muy útil a systemd aquí. Obtiene y mantiene un bot de Telegram ejecutándose como un script de Python.
Если process_a
не использует активно память, она будет выгружена при запуске process_b
.
Таким образом, если вы не видите, что память process_a
выгружена, это может быть связано с тем, что process_a
активно использует память.
Итак, как вы можете заставить process_a
быть неактивным какое-то время?
Вы приостанавливаете его.
kill -TSTP $pid
Затем вы запускаете process_b
и позволяете process_a
перейти к обмену.
Если вы хотите выделить больше памяти для подкачки, проверьте:https://gitlab.com/ole.tange/tangetools/tree/master/swapout
Наконец, когда process_b
выполнено, вы отпускаете тормоз на process_a
:
kill -CONT $pid
Check for the priority of the process
Higher priority is -20
lower prioritty is +19
Neutral is 0
if process_a is having highher priority based on your requirement reduce the priority (-20 to +19). Higher the priority it will consumes most of resources
You can try with ulimit command options too