- 树莓派映射网络磁盘
sudo mount -t cifs -o username=jerry.huang,password=Hello2014 //10.10.0.1/Public/ESLPod.com /home/pi/t/ESLPod.com/
- 树莓派使用 sudo nano 编辑保存文件
修改静态IP,需要修改/etc/network/interfaces文件
原文件内容auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
修改为静态IP
auto lo iface lo inet loopback iface eth0 inet static address 10.10.0.91 netmask 255.255.255.0 gateway 10.10.0.254 allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
编辑自动定时任务/etc/crontab
8,38 8-12,14-17 * * 1-5 root /home/pi/playESLPod.sh 30 8-12,14-17 * * 1-5 root /home/pi/playNews.sh 0 14 * * 1-5 root /home/pi/playNews.sh 5 13 * * 1-5 root /home/pi/stopMplayer.sh 20 18 * * 1-5 root /home/pi/stopMplayer.sh 0 0 * * 6-7 root /home/pi/stopMplayer.sh 30 18 * * 1-5 root /home/pi/playMusic.sh 0 20 * * 1-5 root /home/pi/stopMplayer.sh
- 播放MP3、网络广播的脚本
播放本地音乐playESLPod.sh#!/bin/sh sudo pkill -f mplayer; sudo mplayer -shuffle /home/pi/t/ESLPod.com/* < /dev/null > /dev/null 2>1&
playESLPod.sh Code
播放网络playNews.sh
#!/bin/sh sudo pkill -f mplayer; sudo mplayer -loop 0 -playlist "http://rthk.hk/live2.m3u" < /dev/null > /dev/null 2>1&
playNews.sh Code
播放runMplayer.sh
#!/bin/sh if (ps -A|grep "mplayer");then sudo pkill -f mplayer; fi sudo mplayer -loop 0 -playlist "http://rthk.hk/live$1.m3u" < /dev/null > /dev/null 2>1&
runMplayer.sh Code
停止stopMplayer.sh
#!/bin/sh sudo pkill -f mplayer;
stopMplayer.sh Code
时间: 2024-10-30 16:41:55