编写自己的init.d脚本后为什么不能ping通?

时间:2013-11-03 18:21:44

标签: python init

我用过这个脚本:

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

### BEGIN INIT INFO
# Provides:          bildverteiler
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Simple script to start a program at boot
# Description:       start bildverteiler
### END INIT INFO

# If you want a command to always run, put it here

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting bildverteiler"
    # run application you want to start
    python /home/pi/imageprocess-pi/startDaemon.py restart;
    #python /home/pi/
    ;;
  stop)
    echo "Stopping bildverteiler"
    # kill application you want to stop
    python /home/pi/imageprocess-pi/startDaemon.py stop;
    #killall noip2
    ;;
  restart)
    echo "Stopping bildverteiler"
    # kill application you want to stop
    python /home/pi/imageprocess-pi/startDaemon.py restart;
    #killall noip2
    ;;
  *)
    echo "Usage: /etc/init.d/bildverteiler {start|stop|restart}"
    exit 1;
    ;;
esac

exit 0;

然后我用这一行来注册它:

sudo update-rc.d NameOfYourScript defaults

我可以看到它有效,因为GPIO引脚闪烁。但现在我不能再ping我的设备了。我也无法通过ssh访问它。但我的路由器通过dhcp给它一个IP地址。

这是我的系统日志的最后一行:

Nov  3 17:42:29 boxr wpa_action: id_str=home
Nov  3 17:42:29 boxr wpa_action: mode=station
Nov  3 17:42:29 boxr wpa_action: pairwise_cipher=CCMP
Nov  3 17:42:29 boxr wpa_action: group_cipher=TKIP
Nov  3 17:42:29 boxr wpa_action: key_mgmt=WPA2-PSK
Nov  3 17:42:29 boxr wpa_action: wpa_state=COMPLETED
Nov  3 17:42:29 boxr wpa_action: address=00:87:32:85:80:c9
Nov  3 17:42:29 boxr wpa_supplicant[6041]: wlan0: CTRL-EVENT-TERMINATING - signal 15 received
Nov  3 17:42:30 boxr ifplugd(wlan0)[1684]: Link beat lost.
Nov  3 17:42:31 boxr wpa_supplicant[6165]: nl80211: 'nl80211' generic netlink not found
Nov  3 17:42:31 boxr wpa_supplicant[6165]: Failed to initialize driver 'nl80211'
Nov  3 17:42:31 boxr wpa_supplicant[6165]: rfkill: Cannot open RFKILL control device
Nov  3 17:42:35 boxr wpa_supplicant[6170]: wlan0: Trying to associate with 00:1f:3f:13:01:15 (SSID='no!' freq=2462 MHz)
Nov  3 17:42:35 boxr wpa_supplicant[6170]: wlan0: Association request to the driver failed
Nov  3 17:42:35 boxr wpa_supplicant[6170]: wlan0: Associated with 00:1f:3f:13:01:15
Nov  3 17:42:35 boxr wpa_supplicant[6170]: wlan0: WPA: Key negotiation completed with 00:1f:3f:13:01:15 [PTK=CCMP GTK=TKIP]
Nov  3 17:42:35 boxr wpa_supplicant[6170]: wlan0: CTRL-EVENT-CONNECTED - Connection to 00:1f:3f:13:01:15 completed (auth) [id=0 id_str=home]
Nov  3 17:42:35 boxr wpa_action: WPA_IFACE=wlan0 WPA_ACTION=CONNECTED
Nov  3 17:42:35 boxr wpa_action: WPA_ID=0 WPA_ID_STR=home WPA_CTRL_DIR=/var/run/wpa_supplicant
Nov  3 17:42:36 boxr wpa_action: ifup wlan0=home
Nov  3 17:42:36 boxr dhclient: Internet Systems Consortium DHCP Client 4.2.2
Nov  3 17:42:36 boxr dhclient: Copyright 2004-2011 Internet Systems Consortium.
Nov  3 17:42:36 boxr dhclient: All rights reserved.
Nov  3 17:42:36 boxr dhclient: For info, please visit https://www.isc.org/software/dhcp/
Nov  3 17:42:36 boxr dhclient: 
Nov  3 17:42:36 boxr dhclient: Listening on LPF/wlan0/00:87:32:85:80:c9
Nov  3 17:42:36 boxr dhclient: Sending on   LPF/wlan0/00:87:32:85:80:c9
Nov  3 17:42:36 boxr dhclient: Sending on   Socket/fallback
Nov  3 17:42:36 boxr dhclient: DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3

所以我认为sshd(还有很多其他东西)不再启动了。可能是什么原因?

0 个答案:

没有答案