rc.local このコマンドを正しく実行しません。

rc.local このコマンドを正しく実行しません。

私はアーチLinuxを実行しており、次のrc-localサービスを使用しました。

[Unit]
Description=/etc/rc.local compatibility

[Service]
Type=oneshot
ExecStart=/etc/rc.local
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

これは私のrc.localです。

#!/usr/bin/env bash
iwconfig wlp6s0 frag 256
iwconfig wlp6s0 rts 256
iwconfig wlp6s0 retry 7
exit 0

実行される唯一のコマンドは再試行コマンドです。返される出力を使用してこれを確認できますsudo iwconfig

wlp6s0    IEEE 802.11abg  ESSID:"Hoersdal 5G"  
          Mode:Managed  Frequency:5.18 GHz  Access Point: 54:A0:50:5B:C2:34   
          Bit Rate=117 Mb/s   Tx-Power=200 dBm   
          Retry short  long limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality=35/70  Signal level=-75 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

どうすれば解決できますか?さて、私は次のように実行可能にしました。sudo chmod +x /etc/rc.local

ベストアンサー1

コマンドを実行しようとしましたが、iwconfig実行可能ファイルが見つからないため、失敗する可能性があります。利用可能な変数がないためです$PATH$PATH存在しない可能性がある設定に頼るのではなく、cronスクリプトと同様のスクリプトで常に絶対パス名を使用する必要があります。

おすすめ記事