하나의 시스템에 10개의 GPU가 연결되어 있고 우분투 GUI는 한 번에 10개의 GPU를 실행할 수 없기 때문에 모두 함께 채굴하고 싶습니다. 따라서 명령줄을 사용하여 거기서 채굴할 수 있습니다.
이제 나는 특히 내가 따르고 있는 시스템 시작 시 마이너를 실행하고 싶습니다.이것튜토리얼(7단계). 튜토리얼에 따라 모든 작업을 완료했지만 스크린 세션에서 ./start_only_eth.bash 명령(스크린 세션이 생성되지 않음)을 시작할 수 없습니다.
아래 명령을 실행하는 경우 "screen -ls" 명령을 사용하여 이 세션을 찾을 수 있습니다.
screen -dmS ethm
아래는 내 스크립트(demo.sh)입니다.
// 업데이트
#!/bin/bash
DEFAULT_DELAY=0
if [ "x$1" = "x" -o "x$1" = "xnone" ]; then
DELAY=$DEFAULT_DELAY
else
DELAY=$1
fi
sleep $DELAY
su aman -c "screen -dmS ethm /home/aman/Desktop/claymore/start_only_eth.bash"
위에서 언급한 대로 rc.local 파일에 이 스크립트의 경로를 추가했습니다.이것튜토리얼(7단계).
아래는 내 rc.local입니다
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
sh '/home/aman/Desktop/demo.sh'
exit 0
다시 시작한 후 "screen -ls" 명령을 실행하면 아래 메시지가 나타납니다.
No Sockets found in /var/run/screen/S-aman.
참고: 내 생각에는 문제는 rc.local에 있는 것이 아니고, 데모.sh에 있는 것 같습니다. Demo.sh를 수동으로 실행하려고 하면 스크립트가 실패하고 위의 메시지가 나타납니다.
// // -------------------------- TMUX 사용 ------------------ -- // //
나는 또한 tmux로 이것을 시도했습니다. 이번에는 tmux 세션에서 광부를(수동으로) 실행할 수 있지만 다시 rc.local을 사용하여 스크립트를 실행하는 데 실패합니다. 아래는 내 데모입니다.sh
#!/bin/bash
tmux new-session -d -n MINER
tmux send-keys -t MINER "cd /home/aman/Desktop/claymore" C-m
tmux send-keys -t MINER "./start_only_eth.bash" C-m
다음은 rc.local을 테스트하려고 할 때 내가 얻는 것(콘솔)입니다.
aman@aman-System-Product-Name:~$ sudo /etc/init.d/rc.local start
[sudo] password for aman:
[ ok ] Starting rc.local (via systemctl): rc.local.service.
답변1
cd /home/Desktop/claymore
su aman -c "screen -dmS ethm ./start_only_eth.bash"
여기에는 여러 가지 문제가 있습니다. 우선 경로는 /home/username/Desktop/claymore
. 둘째, cd
현재 스크립트에 영향을 미치며 su를 통해 화면으로 전달되지 않을 가능성이 높습니다.
노력하다:
su aman -c "screen -dmS ethm /home/username/Desktop/claymore/start_only_eth.bash"
스크립트에서 start_only_eth.bash
해당 디렉터리에 PWD를 설정해야 하는 경우 다음 줄을 입력하세요.
cd /home/username/Desktop/claymore
스크립트의 두 번째 줄로.
username
실제 사용자 이름으로 바꿉니다 .