
다음 내용으로 start_test.sh를 만들었습니다.
cd /home/xyz/Desktop/
gnome-terminal -e "bash -c ./efg"
#desktop 폴더에는 이라는 실행 파일이 포함되어 있습니다 efg
.
터미널에서 실행하면 gnome-terminal -e "bash -c ./efg"
정상적으로 작동합니다. 새 터미널을 열고 프로그램이 올바르게 실행되고 있습니다 . 부팅/로그인 후에 efg
이 스크립트를 실행하고 싶습니다 .startup_test.sh
나는 루트 권한을 가진 로그인 상태입니다.
chmod +x startup_test.sh
cp startup_test.sh /usr/sbin/
내 startup_test.service
내용은 다음과 같습니다.
[Unit]
Description=ABC
[Install]
WantedBy=multi-user.target
[Service]
ExecStart=/usr/sbin/startup_test.sh
WorkingDirectory=/home/xyz/Desktop/startup
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=%n
startup_test.service
/etc/systemd/system
폴더 에 들어있습니다 .
이제 명령은
systemctl daemon-reload
실행됩니다. 출력이 없습니다.
이제 명령은 systemctl enable startup_test.service
다음과 같은 출력을 제공합니다.
Failed to enable unit : Invalid argument
위 출력의 원인은 무엇입니까?
명령이 systemctl start startup_test.service
출력을 제공하지 않습니다.
명령은 다음 systemctl status startup_test.service
을 제공합니다.
startup_test.service - ABC
Loaded: loaded (/etc/systemd/system/startup_test.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2024-02-19 12:09:20 IST; 2min 55s ago
Process: 32531 ExecStart=/usr/sbin/startup_test.sh (code=exited, status=203/EXEC)
Main PID: 32531 (code=exited, status=203/EXEC)
Feb 19 12:09:20 localhost.localdomain systemd[1]: Started ABC.
Feb 19 12:09:20 localhost.localdomain systemd[1]: startup_test.service: Main process exited, code=exited, status=203/EXEC
Feb 19 12:09:20 localhost.localdomain systemd[1]: startup_test.service: Failed with result 'exit-code'.
운영체제는 레드햇 8.2 입니다