我有一个安卓ppp脚本,如何让它在开机时自动调用:# /etc/ppp/peers/quectel-pppd # Usage:root>pppd call quectel-pppd #Modem path, like /dev/ttyUSB3,/dev/ttyACM0, depend on your module, default path is /dev/ttyUSB3 /dev/ttyUSB3 115200 #Insert the username and password for authentication, default user and password are test user "test" password "test" # The chat script, customize your APN in this file connect 'chat -s -v -f /etc/ppp/peers/quectel-chat-connect' # The close script disconnect 'chat -s -v -f /etc/ppp/peers/quectel-chat-disconnect' # Hide password in debug messages hide-password # The phone is not required to authenticate noauth # Debug info from pppd debug # If you want to use the HSDPA link as your gateway defaultroute # pppd must not propose any IP address to the peer noipdefault # No ppp compression novj novjccomp noccp ipcp-accept-local ipcp-accept-remote local # For sanity, keep a lock on the serial line modem dump nodetach # Hardware flow control nocrtscts remotename 3gppp ipparam 3gppp ipcp-max-failure 30 # Ask the peer for up to 2 DNS server addresses usepeerdns并且在脚本中添加下面这一操作:
时间: 2023-12-10 11:42:40 浏览: 162
Android安卓app 让程序开机自动运行APP.zip
5星 · 资源好评率100%
你可以将这个脚本放在 /etc/init.d/ 目录下,并添加启动脚本来确保它在开机时被调用。具体步骤如下:
1. 将脚本复制到 /etc/ppp/peers/quectel-pppd 中。
2. 创建一个启动脚本 /etc/init.d/quectel-pppd,内容如下:
```
#!/bin/sh
# chkconfig: 2345 99 01
# description: auto start quectel-pppd
case "$1" in
start)
echo "Starting quectel-pppd..."
/usr/sbin/pppd call quectel-pppd
;;
stop)
echo "Stopping quectel-pppd..."
killall pppd
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
;;
esac
exit 0
```
3. 添加执行权限:
```
chmod +x /etc/init.d/quectel-pppd
```
4. 将脚本添加到启动项中:
```
update-rc.d quectel-pppd defaults
```
这样,在下一次重启后,quectel-pppd 脚本将会自动被调用。
阅读全文