Dropbox 备份 小型网站(使用sqlite数据库)

wget https://raw.github.com/andreafabrizi/DropboxUploader/master/dropbox_uploader.sh

chmod +x dropbox_uploader.sh

./dropbox_uploader.sh info

 

vi backup.sh

#!/bin/bash
SCRIPT_DIR=”/root”
DROPBOX_DIR=”/ovh_zq_1″
BACKUP_SRC=”/var/www”
BACKUP_DST=”/tmp”

NOW=$(date +”%Y.%m.%d”)
DATEM=$(date +”%Y_%m”)
DESTFILE=”$BACKUP_DST/$NOW.tar.gz”

tar cfz “$DESTFILE” $BACKUP_SRC

$SCRIPT_DIR/dropbox_uploader.sh upload “$DESTFILE” “$DROPBOX_DIR/$DATEM/$NOW.tar.gz”

rm -f “$DESTFILE”

 

cron来做定时任务

crontab e

0 5 * * * /bin/bash /root/backup.sh

/etc/rc.d/init.d/crond restart

Debian 安装 VNC 和 XFCE

apt-get install xfce4 xfce4-goodies gnome-icon-theme tightvncserver iceweasel

adduser vnc

apt-get install sudo

gpasswd -a vnc sudo

su – vnc

 

 

运行

vncserver

停止

vncserver -kill :1

 

 

—黑屏处理

vi /root/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

Centos 7 安装 VNC 和 GNOME 桌面 或 xfce

yum groupinstall “GNOME Desktop”

yum install tigervnc-server

cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:1.service

vi /etc/systemd/system/[email protected]:1.service

 

更改

 

#ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
#PIDFile=/home/<USER>/.vnc/%H%i.pid
ExecStart=/sbin/runuser -l root-c "/usr/bin/vncserver %i"
PIDFile=/home/root/.vnc/%H%i.pid

如果有防火墙

firewall-cmd --permanent --zone=public --add-service vnc-server
firewall-cmd --reload


启动vnc
vncserver

启动运行
systemctl daemon-reload
systemctl enable [email protected]:1.service
reboot
systemctl start [email protected]:1.service


xfce

yum -y install epel-release
yum -y group install "Xfce"
yum -y group install "X Window System"

—黑屏处理

vi /root/.vnc/xstartup
#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
startxfce4 &

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &

 

 

vncserver -kill :1

vncserver

 

 

CentOS5 6 7 安装 VirtualBox

vim /etc/yum.repos.d/virtualbox.repo

 

 

[virtualbox]
name=Oracle Linux / RHEL / CentOS-$releasever / $basearch – VirtualBox
baseurl=http://download.virtualbox.org/virtualbox/rpm/el/$releasever/$basearch
enabled=1
gpgcheck=1
gpgkey=http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc

 

 

CentOS/RHEL 7, 64 Bit (x86_64):
# rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm

CentOS/RHEL 6, 32 Bit (i386):
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

CentOS/RHEL 6, 64 Bit (x86_64):
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

CentOS/RHEL 5, 32 Bit (i386):
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

CentOS/RHEL 5, 64 Bit (x86_64):
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm

# yum install gcc make patch dkms qt libgomp -y
# yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel -y

export KERN_DIR=/usr/src/kernels/2.6.32-504.3.3.el6.x86_64

yum install VirtualBox-5*
service vboxdrv setup

CentOS5 安装 XFCE VNC 和 浏览器

yum groupinstall xfce-4.4

yum install vnc vnc-server

 

vi /etc/sysconfig/vncservers

添加

VNCSERVERS=”1:root”
VNCSERVERARGS[1]=”-geometry 1024×768″

vncserver

配置环境

vi /root/.vnc/xstartup

替换

#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
#xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop”&
#twm &
startxfce4 &

开机启动
chmod +x ~/.vnc/xstartup
service vncserver restart
chkconfig vncserver on

到这里 VNC 已经可用

yum -y install firefox
yum -y install fonts-chinese