日本免费全黄少妇一区二区三区-高清无码一区二区三区四区-欧美中文字幕日韩在线观看-国产福利诱惑在线网站-国产中文字幕一区在线-亚洲欧美精品日韩一区-久久国产精品国产精品国产-国产精久久久久久一区二区三区-欧美亚洲国产精品久久久久

E680系列 Linux手機DIY.Shell應(yīng)用擴展一 隨機來電鈴聲( 二 )


mv Artist.mp3 ring.mp3這么簡單 。
下面需要解決的就是修改時機和隨即性兩個問題 。我這里顯然是一個在后臺不斷循
環(huán)運行的Shell腳本,當短信息或者來電時,系統(tǒng)會啟動alterprocss這個進程,這個腳
本自然能檢測的這個進程相關(guān)信息,并修改相應(yīng)的鈴聲文件 。至于隨機性,其實來電本
身就是隨機事件,這里只用了一個偽隨即方法,即根據(jù)來電的時間信息,進行鈴聲文件
選擇 。

三、腳本文件全內(nèi)容
001#!/bin/bash
002
003
004#當前路徑
005Path_Current=/mmc/mmca1/soft/ring
006
007#日志文件
008File_Log=$Path_Current/log.txt
009
010#來電鈴聲目錄
011if [ ! -f $Path_Current/ring.txt ]
012then
013echo /mmc/mmca1/Music/Game > $Path_Current/ring.txt
014fi
015Path_Ring=`cat $Path_Current/ring.txt`
016
017#短信息鈴聲目錄
018if [ ! -f $Path_Current/msg.txt ]
019then
020echo /mmc/mmca1/Music/Game > $Path_Current/msg.txt
021fi
022Path_Message=`cat $Path_Current/msg.txt`
023
024#固定來電消息文件目錄
025if [ ! -f $Path_Current/default.txt ]
026then
027echo /mmc/mmca1/Music/Ring > $Path_Current/default.txt
028IsReset=1
029else
030IsReset=0
031fi
032Path_Default=`cat $Path_Current/default.txt`
033
034
035#系統(tǒng)預(yù)定義短信最長秒
036if [ ! -f $Path_Current/maxmessage.txt ]
037then
038echo "15" > $Path_Current/maxmessage.txt
039fi
040Var_MsgMaxSec $Path_Current/maxmessage.txt`
041
042#指定的短消息鈴聲
043Default_MessageFile=$Path_Default/message.mp3
044#指定的電話鈴聲
045Default_RingFile=$Path_Default/ring.mp3
046
047
048#指令集
049File_Busybox=/mmc/mmca1/tmp/busybox
050#臨時處理配置的文件
051File_Sed=$Path_Current/tmpsed.txt
052#臨時文件大聲
053File_TmpRingLoud=$Path_Current/tmpRingLoud.pts
054#臨時文件輕聲
055File_TmpRingSoft=$Path_Current/tmpRingSoft.pts
056
057#臨時進程文件
058File_TmpProcess=$Path_Current/tmpgrep.txt
059
060
061#臨時可供隨機的文件列表
062FileList_Tmp=filelist.txt
063
064#系統(tǒng)大聲的配置文件
065File_RingLoud=/ezxlocal/download/appwrite/setup/RingLoud.pts
066#系統(tǒng)輕聲的配置文件
067File_RingSoft=/ezxlocal/download/appwrite/setup/RingSoft.pts
068
069
070echo "====== Random Ring ======" >> $File_Log
071echo `$File_Busybox date` " : Start" >> $File_Log
072
073
074if [ "$IsReset" = "1" ]
075then
076
077echo `$File_Busybox date` " : Create New PtsFile" >> $File_Log
078
079#生成新的配置文件
080echo "#!/bin/sed -f" > $File_Sed
081echo "/AlertRingTone1/ c" >> $File_Sed
082echo "AlertRingTone1 = $Default_RingFile" >> $File_Sed
083echo "/AlertRingTone2/ c" >> $File_Sed
084echo "AlertRingTone2 = $Default_RingFile" >> $File_Sed
085echo "/AlertTextMsg/ c" >> $File_Sed
086echo "AlertTextMsg = $Default_MessageFile" >> $File_Sed
087
088#echo $File_Sed " " $File_RingLoud
089$File_Sed $File_RingLoud > $File_TmpRingLoud
090$File_Sed $File_RingSoft > $File_TmpRingSoft
091
092cp -f $File_TmpRingLoud $File_RingLoud
093cp -f $File_TmpRingSoft $File_RingSoft
094
095fi
096
097#$File_Busybox renice -20 $$
098echo $$ > $Path_Current/proc.txt
099
100echo `$File_Busybox date` " : ProcessID " $$ >> $File_Log
101
102while
103
104do
105
106ProcID_Alert=`pidof alertprocess`
107
108if [ "$ProcID_Alert" = "" ]
109then
110
111echo "Runing ..."
112sleep 1s
113
114else
115
116echo `$File_Busybox date` " : AlertProcessID " $ProcID_Alert >> $File_Log
117
118ps -ef | grep ".mp3" | grep -v grep > $File_TmpProcess
119
120if grep "ring.mp3" $File_TmpProcess | grep -v grep
121then
122HaveSession="PHONE"
123echo `$File_Busybox date` " : Have Phone " >> $File_Log
124fi
125
126if grep "message.mp3" $File_TmpProcess | grep -v grep

推薦閱讀