etherwake를 사용하는 Debian 8(Jessie)의 시작 스크립트가 작동하지 않습니다.

etherwake를 사용하는 Debian 8(Jessie)의 시작 스크립트가 작동하지 않습니다.

etherwake매직 패킷을 보내는 명령을 사용하여 bash 스크립트를 통해 마스터가 부팅될 때 슬레이브 시스템을 원격으로 깨우려고 합니다 . 두 OS 모두 Debian 8입니다. 전체 코드는 다음과 같습니다.

/etc/init.d/etherwake

#!/bin/sh
#/etc/init.d/etherwake

### BEGIN INIT INFO
# Provides: etherwake
# Required-Start: $all
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start etherwake at boot time
# Description: Enable service provided by etherwake.
### END INIT INFO

ETHERWAKE=/usr/sbin/etherwake

case "$1" in

        start)
                echo  "Booting slaves through etherwake..."
                $ETHERWAKE <MAC Address>
                echo  "Finished booting all slaves."
                ;;

        stop)
                echo "Stop not implemented. Doing nothing"
                ;;

        restart|force-reload)
                $0 stop
                sleep 10
                $0 start
                ;;

        *)
                echo "Usage: /etc/init.d/etherwake {start}"
                exit 1
                ;;
esac

exit 0

스크립트를 작성한 후 다음을 수행했습니다.

  1. chmod 755 /etc/init.d/etherwake
  2. update-rc.d etherwake defaults
  3. 다음을 통해 시스템을 재부팅합니다.shutdown -r now

/etc/rc.local또한 3가지 다른 방법으로 사용해 보았습니다 .

/etc/rc.local

#!/bin/sh -e
#
# rc.local

/etc/init.d/etherwake
etherwake <MAC Address>
/usr/sbin/etherwake <MAC Address>
exit 0

전혀 행운이 없습니다. 루트로 /etc/rc.local또는 수동으로 실행하면 모든 것이 잘 작동합니다. /etc/init.d/etherwake권한이 있는 것일 수 있다고 생각했지만 스크립트를 읽는 한 /etc/init.d기본적으로 루트로 실행됩니다. 내가 도대체 ​​뭘 잘못하고있는 겁니까?

미리 감사드립니다.


편집하다:

나는 Debian 8이 sysvinit 대신 systemd를 사용한다는 것을 알고 있습니다. 모든 것을 설정한 후 다음을 systemctl -l status etherwake.service제공합니다.

● etherwake.service - Etherwake magic packet service
   Loaded: loaded (/etc/systemd/system/etherwake.service; enabled)
   Active: inactive (dead) since Fri 2016-09-30 16:30:56 BRT; 1min 33s ago
  Process: 824 ExecStart=/etc/init.d/etherwake start (code=exited, status=0/SUCCESS)
 Main PID: 824 (code=exited, status=0/SUCCESS)

Sep 30 16:30:56 hostname etherwake[824]: Booting slaves through etherwake...
Sep 30 16:30:56 hostname etherwake[824]: Finished booting all slaves.

그리고 /etc/systemd/system/etherwake.service는:

[Unit]
Description=Etherwake magic packet service
Wants=network-online.target
After=syslog.service network.target network-online.target

[Service]
ExecStart=/etc/init.d/etherwake start

[Install]
WantedBy=default.target

내가 깨달은 또 다른 점은 달리기가 systemctl restart etherwake매력으로 작용한다는 것입니다.

답변1

문제는 update-rc.d etherwake defaults어쩌면 작동하지 않을 수도 있다는 것입니다. 를 통해 서비스를 활성화하고 systemctl다음을 실행하십시오.

systemctl enable etherwake

관련 정보