Skip to content
This repository has been archived by the owner on Apr 13, 2018. It is now read-only.

Commit

Permalink
完善launcher脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
wzpan committed Oct 28, 2017
1 parent 7f8c6e4 commit da1bfe3
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 56 deletions.
33 changes: 0 additions & 33 deletions launcher/dingdang-AutoUpdate-Launcher-for-pi-User.sh

This file was deleted.

17 changes: 0 additions & 17 deletions launcher/dingdang-Launcher.sh

This file was deleted.

18 changes: 12 additions & 6 deletions ...dang-AutoUpdate-Launcher-for-root-User.sh → ...cher/dingdang-autoupdate-launcher-root.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/bin/bash
sleep 1

# tmux session name
session_name="dingdang"

#Delete Cache
sudo rm -r /root/.cache
sudo rm -r /root/.config
sudo rm -r /root/.netease-musicbox
sudo rm -r /root/userInfo
sleep 1
Expand All @@ -21,12 +23,16 @@ sudo pip install --upgrade -r requirements.txt
sleep 1

#Restore Configuration of AlsaMixer
alsactl --file=/home/pi/asound.state restore
sleep 1
if [ -f /home/pi/asound.state ]; then
alsactl --file=/home/pi/asound.state restore
sleep 1
fi

#Launch Dingdang in LxTerminal
sudo lxterminal -e "python /home/pi/dingdang/dingdang.py"
#Launch Dingdang in tmux
sudo tmux new-session -d -s $session_name $HOME/dingdang/dingdang.py
sleep 1

#Start Respeaker-Switcher in Background
sudo python /home/pi/ReSpeaker-Switcher/switcher.py &
if [ -d /home/pi/ReSpeaker-Switcher]; then
sudo python /home/pi/ReSpeaker-Switcher/switcher.py &
fi
39 changes: 39 additions & 0 deletions launcher/dingdang-autoupdate-launcher-user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash
sleep 1

# tmux session name
session_name="dingdang"

#Delete Cache
sudo rm -r $HOME/.cache
sudo rm -r $HOME/.netease-musicbox
sudo rm -r $HOME/userInfo
sleep 1

#AutoUpdate Before Launch
#Update dingdang-robot
cd $HOME/dingdang
git pull

#Update dingdang-contrib
cd $HOME/.dingdang/contrib
git pull

#Update dingdang-contrib Requirements
sudo pip install --upgrade -r requirements.txt
sleep 1

#Restore Configuration of AlsaMixer
if [ -f $HOME/asound.state ]; then
alsactl --file=$HOME/asound.state restore
sleep 1
fi

#Launch Dingdang in tmux
tmux new-session -d -s $session_name $HOME/dingdang/dingdang.py
sleep 1

#Start Respeaker-Switcher in Background
if [ -d $HOME/ReSpeaker-Switcher]; then
sudo python $HOME/ReSpeaker-Switcher/switcher.py &
fi
21 changes: 21 additions & 0 deletions launcher/dingdang-launcher-root.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
sleep 1

#Delete Cache
sudo rm -r /root/.cache
sudo rm -r /root/.netease-musicbox
sudo rm -r /root/userInfo

#Restore Configuration of AlsaMixer
if [ -f /home/pi/asound.state ]; then
alsactl --file=/home/pi/asound.state restore
sleep 1
fi

#Start DingDang
sudo tmux new-session -d -s $session_name $HOME/dingdang/dingdang.py
sleep 1

if [ -d /home/pi/ReSpeaker-Switcher]; then
sudo python /home/pi/ReSpeaker-Switcher/switcher.py &
fi
21 changes: 21 additions & 0 deletions launcher/dingdang-launcher-user.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
sleep 1

#Delete Cache
sudo rm -r /root/.cache
sudo rm -r /root/.netease-musicbox
sudo rm -r /root/userInfo

#Restore Configuration of AlsaMixer
if [ -f /home/pi/asound.state ]; then
alsactl --file=/home/pi/asound.state restore
sleep 1
fi

#Start DingDang
tmux new-session -d -s $session_name $HOME/dingdang/dingdang.py
sleep 1

if [ -d /home/pi/ReSpeaker-Switcher]; then
sudo python /home/pi/ReSpeaker-Switcher/switcher.py &
fi

0 comments on commit da1bfe3

Please sign in to comment.