
저는 라즈베리 파이 3 모델 b arm 버전을 개발 중입니다. Debian을 실행하고 있습니다. 부팅 시 스크립트를 실행해야 합니다. 이를 위해 /etc./Rc.local을 사용하고 있습니다. 다음 레시피를 따랐습니다.https://www.cyberciti.biz/faq/how-to-enable-rc-local-shell-script-on-systemd-while-booting-linux-system/ 모든 것이 잘 작동하고 있습니다. log.txt 파일로 보내는 일부 에코 로그가 있고 명령이 실행되는 것을 볼 수 있지만 실제로 필요한 스크립트를 실행하려고 하면 작동하지 않습니다. Rc의 다른 모든 명령은 .local 파일이 실행되고 있지만 가장 중요한 파일이 없습니다.
/etc/rc.local 파일:
> ##Reload deamon
sudo systemctl daemon-reload && echo "Daemon -> SUCCESS" >> /tmp/mounter_test.txt || echo "Daemon -> FAIL" >>
> /tmp/mounter_test.txt
> ##Checking which user is running
> whoami >> /tmp/mounter_test.txt
> ##Check log
> echo "First try" >> /tmp/mounter_test.txt
> enc /opt&
>
> if [ $? -eq 0 ]; then
> echo "The mounter is running" >> /tmp/mounter_test.txt else
> echo "The mounter has failed!!" >> /tmp/mounter_test.txt fi
>
> exit 0
고양이/tmp/enc_test.txt
SUCCESS root First try The mounter is running
systemctl staus rc-local.service ----시작 후----
● rc-local.service - /etc/rc.local Compatibility Loaded: loaded (/lib/systemd/system/rc-local.service; enabled-runtime; vendor preset: enabled) Drop-In: /usr/lib/systemd/system/rc-local.service.d └─debian.conf /etc/systemd/system/rc-local.service.d └─ttyoutput.conf Active: active (exited) since Tue 2022-05-17 09:37:56 BST; 2min 27s ago Docs: man:systemd-rc-local-generator(8) Process: 477 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS) May 17 09:37:55 raspberrypi systemd[1]: Starting /etc/rc.local Compatibility... May 17 09:37:55 raspberrypi sudo[480]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/systemctl daemon-reload May 17 09:37:55 raspberrypi sudo[480]: pam_unix(sudo:session): session opened for user root by (uid=0) May 17 09:37:56 raspberrypi sudo[480]: pam_unix(sudo:session): session closed for user root May 17 09:37:56 raspberrypi systemd[1]: Started /etc/rc.local Compatibility.
한 가지 더 중요한 점은 터미널에서 /etc/rc.local을 실행하면 암호화가 작동하므로 이 명령과 rc.local에 있는 명령만 있다는 것입니다.
도와주셔서 감사합니다! 다들 감사 해요:)