|  | 
 
 发表于 2017-6-25 20:02:55
|
显示全部楼层 
| 本帖最后由 legendmax 于 2017-6-25 20:32 编辑 
 要不是你试下我这份脚本吧,在Ubuntu 14.04和16.04下经过测试
 
 
 复制代码#!/bin/bash
#适用于 Ubuntu 14 / Ubuntu 16
normal()
{
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
#vnc
apt-get update
apt-get install -y sed xorg lxde-core tightvncserver
tightvncserver :1
tightvncserver -kill :1
echo "lxterminal &" >> /root/.vnc/xstartup
echo "/usr/bin/lxsession -s LXDE &" >> /root/.vnc/xstartup
tightvncserver :1
#byobu
apt-get install -y tmux byobu
#firefox
apt-get install -y firefox
#flashplugin
cd ${BASE_DIR}
if [ $(getconf WORD_BIT) = '32' ] && [ $(getconf LONG_BIT) = '64' ] ; then
        wget --no-check-certificate https://fpdownload.macromedia.com/pub/labs/flashruntimes/flashplayer/linux64/flash_player_npapi_linux.x86_64.tar.gz
        tar -zxvf flash_player_npapi_linux.x86_64.tar.gz
        cp libflashplayer.so /usr/lib/firefox-addons/plugins
else
        wget --no-check-certificate https://fpdownload.macromedia.com/pub/labs/flashruntimes/flashplayer/linux32/flash_player_npapi_linux.i386.tar.gz
        tar -zxvf flash_player_npapi_linux.i386.tar.gz
        cp libflashplayer.so /usr/lib/firefox-addons/plugins
fi
#restart
cat > ${BASE_DIR}/restart_ff.sh << EOF
#!/bin/sh
BASE_DIR="$( cd "$( dirname "$0"  )" && pwd  )"
export DISPLAY=localhost:1.0
rm -rf ~/.vnc/*.log /tmp/plugtmp* > /dev/null 2>&1
ps -ef | grep firefox | grep -v grep | cut -c 9-15 | xargs kill -s 9 > /dev/null 2>&1
ps -ef | grep restarter.jar | grep -v grep | cut -c 9-15 | xargs kill -s 9 > /dev/null 2>&1
/usr/bin/firefox --new-tab http://www.ebesucher.de/surfbar/username > /dev/null 2>&1 &
EOF
chmod +x ${BASE_DIR}/restart_ff.sh
echo "0  * * * root ${BASE_DIR}/restart_ff.sh" >> /etc/crontab
service cron restart
echo "Finished."
}
java()
{
BASE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
apt-get install -y unzip
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/java-8.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" >> /etc/apt/sources.list.d/java-8.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
apt-get install -y oracle-java8-installer
cd ${BASE_DIR}
wget --no-check-certificate https://www.ebesucher.com/data/restarter-setup-others.v1.2.03.zip
unzip restarter-setup-others.v1.2.03.zip
echo "sleep 10s" >> ${BASE_DIR}/restart_ff.sh
echo "/usr/bin/java -jar ${BASE_DIR}/restarter.jar" >> ${BASE_DIR}/restart_ff.sh
}
action=$1
[ -z $1 ] && action=n
case "$action" in
n)
    normal
    ;;
j)
    java
    ;;
*)
    echo "Arguments error!"
    ;;
esac
 把http://www.ebesucher.de/surfbar/username 这一行的username改成自己的,脚本执行过程会提示设置VNC密码,VNC默认端口为5900起,默认没安装Java,保存脚本为ebe.sh,执行./ebe.sh java 安装restarter,如果需要适配Debian的可以PM我
 | 
 |