우분투 서버, 서비스/데몬 시작을 시도 중

우분투 서버, 서비스/데몬 시작을 시도 중

나는 지시를 따랐다.여기, 그러나 "sudo service mydaemon start"를 입력하면. "mydaemon: 인식할 수 없는 서비스"라는 메시지가 나타납니다. 파일이 올바른 위치에 있는지 확인하고 스크립트 파일(echoHW.sh)을 실행 가능하게 만드는 추가 단계를 수행했지만 여전히 성공하지 못했습니다. 어떤 도움이라도 대단히 감사하겠습니다.

답변1

입력한 sudo crontab -e다음 nano편집자로 선택했습니다. 아래 설명과 함께 nano가 나타났습니다. 하단에 스크립트를 추가한 후 재부팅했습니다. 이제 시스템이 부팅될 때마다 내 작업이 실행됩니다.

# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h  dom mon dow   command
@reboot /path/to/script.sh

답변2

/etc/init.d/(서비스 이름)에서 서비스를 찾아 실행해 보셨나요?

init.d 폴더에 있는 셸 프로그램을 실제로 실행하지 않고 서비스를 호출하는 데 익숙하지 않지만 서비스를 시작하는 셸 프로그램이 init.d 아래에 있으면 설정이 쉬워서 호출할 수 있을 것이라고 확신합니다. 원하는 경우 - "service mydaemon [명령]"

답변3

스크립트가 실행 가능하지 않으면 해당 오류가 발생할 수 있습니다.

sudo chmod +x /etc/init.d/mydaemon

답변4

라우터에서 포트 전달을 설정하셨나요? 그렇지 않은 경우 포트 전달과 고정 IP 주소 + DNS(DNS 공급자가 필요하거나 자체 DNS 서버가 있어야 함)를 설정하십시오. 포트 포워딩여기.

관련 정보