chroot
puede tomar un comando para ejecutar esto podría funcionar:
chroot /mnt/hard_disk rpm -i glibc*.rpm
Además, rpm
tiene la opción --root
así que esta es otra opción:
rpm -i --root /mnt/hard_disk glibc*.rpm
If we include Restart=always in the.service file, does this mean that it again executes ExecStart after the script finishes and hence keeps executing the script in a loop?
Опция Restart
вызывается, только если запущенный процесс завершается; с always
, согласно документации systemd.service , служба будет перезапущена, если процесс завершится из-за:
Далее в документации говорится:
As exceptions to the setting above, the service will not be restarted if the exit code or signal is specified in RestartPreventExitStatus= (see below) or the service is stopped with systemctl stop or an equivalent operation. Also, the services will always be restarted if the exit code or signal is specified in RestartForceExitStatus= (see below).
Поскольку вы не настраиваете ни RestartForceExitStatus, ни RestartPreventExitStatus, процесс будет остановлен только systemd во времяsystemctl stop
(«или эквивалентной операции» ).
Does app_script.sh start get called continuously, or only if the system service stops?
Ни то, ни другое. Он не вызывается непрерывно, как описано выше. Он также не вызывается, если служба останавливается (, кроме вызова /application/app_script.sh stop
, конечно ); только когда запущенный службой процесс останавливается.
Обратите внимание, что служба Type=simple
указывает systemd считать параметр ExecStart
фактической службой. Ваше соглашение об именах /application/app_script.sh start
подразумевает, что задействован сценарий оболочки, который, вероятно, вызывает один или несколько других сценариев или двоичных файлов. Если ваш сценарий оболочки разветвляет этот процесс и сам завершает работу, systemd будет считать, что ваш служебный процесс завершился.