Ubuntu 14.04:脚本未在 /etc/network/if-up.d 中运行

Ubuntu 14.04:脚本未在 /etc/network/if-up.d 中运行

无线信息 pasteit

我尝试让 Ubuntu 在 /etc/network/if-up.d/ 中运行此脚本,以便在 eth0 网络启动后通过 hostapd 启动我的无线 AP:

    #!/bin/sh # filename: ap_up.sh 
    /home/adp/bin/ap_ctl --start | tee /home/adp/bin/log/ap_ctl_start.txt 
    /home/adp/bin/ap_ctl --ics | tee /home/adp/bin/log/ap_ctl_ics.txt

但是,每行之间都有空格,但我不知道如何使用这种代码格式按原样粘贴它。sh 会忽略空格,是吗?

一旦登录到 adp(非 root 用户),就不会创建任何日志 - 并且可以通过 ifconfig 确认 - wlan0 未启动且脚本未运行。

我可以手动执行脚本(当然,以 root 身份执行),它会正常调出界面。我只是无法让 Ubuntu 执行此操作,我认为这与 ap_up.sh 位于 root 中而 adp 无权访问 root 有关。我走在正确的轨道上吗?

更新:将脚本移至/usr/local/bin并更正所有文件路径,然后重新启动。这次它在 Ubuntu 启动画面上挂断,说它将再等待 60 秒以等待网络配置,后来又说它将在没有完整网络配置的情况下启动。

我的--start日志看起来很好,并且看起来wlan0很好ifconfigiwconfig显示它已启动并处于主模式......但我的手机看不到它。

/var/log/hostapd.log看起来像这样:

random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
Line 56: DEPRECATED: 'dump_file' configuration variable is not used anymore
ctrl_interface_group=0
rfkill: initial event: idx=0 type=1 op=0 soft=0 hard=0
nl80211: TDLS supported
nl80211: TDLS external setup
nl80211: Supported cipher 00-0f-ac:1
nl80211: Supported cipher 00-0f-ac:5
nl80211: Supported cipher 00-0f-ac:2
nl80211: Supported cipher 00-0f-ac:4
nl80211: Supported cipher 00-0f-ac:10
nl80211: Supported cipher 00-0f-ac:8
nl80211: Supported cipher 00-0f-ac:9
nl80211: Supported cipher 00-0f-ac:6
nl80211: Supported cipher 00-0f-ac:13
nl80211: Supported cipher 00-0f-ac:11
nl80211: Supported cipher 00-0f-ac:12
nl80211: Using driver-based off-channel TX
nl80211: Use separate P2P group interface (driver advertised support)
nl80211: interface wlan0 in phy phy0
nl80211: Set mode ifindex 3 iftype 3 (AP)
nl80211: Setup AP(wlan0) - device_ap_sme=0 use_monitor=0
nl80211: Subscribe to mgmt frames with AP handle 0x1086790
nl80211: Register frame type=0xb0 nl_handle=0x1086790 match=
nl80211: Register frame command failed (type=176): ret=-114 (Operation already in progress)
nl80211: Register frame match - hexdump(len=0): [NULL]
nl80211: Could not configure driver mode
nl80211: Remove monitor interface: refcount=0
nl80211: Remove beacon (ifindex=3)
netlink: Operstate: ifindex=3 linkmode=0 (kernel-control), operstate=6 (IF_OPER_UP)
nl80211 driver initialization failed.
hostapd_interface_deinit_free(0x1085d90)
hostapd_interface_deinit_free: num_bss=1 conf->num_bss=1
hostapd_interface_deinit(0x1085d90)
hostapd_bss_deinit: deinit bss wlan0
hostapd_cleanup(hapd=0x10897b0 (wlan0))
hostapd_free_hapd_data: Interface wlan0 wasn't started
hostapd_interface_deinit_free: driver=(nil) drv_priv=(nil) -> hapd_deinit
hostapd_interface_free(0x1085d90)
hostapd_interface_free: free hapd 0x10897b0
hostapd_cleanup_iface(0x1085d90)
hostapd_cleanup_iface_partial(0x1085d90)
hostapd_cleanup_iface: free iface=0x1085d90

我的 --ics 是启动我的 iptables,它报告“网络停止/预启动,进程 810”

现在有什么想法吗?

相关内容