Ver 2.0 cloud chay engine config.json

This commit is contained in:
HaiMD 2020-05-28 09:11:49 +07:00
parent c14ce4f4e0
commit 4516260cf6
16 changed files with 368 additions and 0 deletions

6
monitor/cache/clearcache.sh vendored Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
sync; echo 1 > /proc/sys/vm/drop_caches
time_begin=$(date)
echo "$time_begin : clearcache!!" >> /root/monitor/log/cache.txt
echo "************************************" >> /root/monitor/log/cache.txt
exit 0

6
monitor/cache/restart_service.sh vendored Normal file
View File

@ -0,0 +1,6 @@
#!/bin/bash
time_begin=$(date)
echo "$time_begin : restart service!!" >> /root/monitor/log/cache.txt
systemctl restart S905X_BI
echo "************************************" >> /root/monitor/log/cache.txt
exit 0

BIN
monitor/check/Check_engine Normal file

Binary file not shown.

View File

BIN
monitor/launcher/S905X_BI Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
log

View File

@ -0,0 +1 @@
log

View File

@ -0,0 +1 @@
log

View File

@ -0,0 +1 @@
{"servermqtt":"","url":""}

8
monitor/setup/capture.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
##ssfull script
export DISPLAY=:0
DATE=$(date +%Y-%m-%d-%H:%M:%S)
gnome-screenshot -f /root/monitor/log/capture/Screenshot-$DATE.png
sshpass -p '1' scp -P 2122 -o StrictHostKeyChecking=no /root/monitor/log/capture/Screenshot-$DATE.png aibox@gitlab.beetsoft.com.vn:/home/aibox/capture_log
echo "capture & copy done!"
exit 0

View File

@ -0,0 +1,29 @@
#!/bin/bash
#*************cap quyen****************************
sudo chmod +x /root/monitor/launcher/S905X_BI
sudo chmod +x /root/monitor/check/Check_engine
sudo chmod +x /root/monitor/check/run_check.sh
sudo chmod +x /root/monitor/ssh/open_ssh.sh
sudo chmod +x /root/monitor/cache/clearcache.sh
sudo chmod +x /root/monitor/CMS/install.sh run_cms.sh
sudo chmod +x /root/monitor/setup/run_CMS.sh install_S905X_BI.sh
sudo chmod +x /root/monitor/setup/install_box/install_box.sh env.sh
#*************setup service S905X_BI***************
cd /etc/systemd/system/
echo "[Unit]
Description=S905X_BI demo service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/env /root/monitor/launcher/S905X_BI
[Install]
WantedBy=multi-user.target" >> S905X_BI.service
sudo chmod 755 S905X_BI.service
sudo systemctl start S905X_BI
sudo systemctl enable S905X_BI
exit 0

59
monitor/setup/key.sh Normal file
View File

@ -0,0 +1,59 @@
#!/bin/bash
#
cd
sudo mkdir ./.ssh
cd ./.ssh
echo "ssh_tunnel.beetai.com ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDrPNPKCfNJ9Vg1vrTXP7iwYDMr8qtXroacRfjrhOWup6rGvaLGBCzuRcbHEBDxmHxTzc/VsSSbD5HQn/31GDPM=" >> known_hosts
echo "-----BEGIN RSA PRIVATE KEY-----
MIIJKgIBAAKCAgEAwROlf/GBogweN1qOeZ9baW4B8ZUakEVu2NMHxkWdqWVlPWky
cscA6sAruSKFwIMgh+CixNsTGtyTl4LcnByrYsjxIFMHAKBJ2jRDT8rr/3Vu53zr
vcw6AwW5nqQ0r0c9Pl1hT8O/Ipc5g4YQWbZ80JcR6KSAMB3txDY8nxHX7kyQrAsO
eeTHuNjtH2Ing/0fG2MecxCvPmnd2rfEWVs4ynru69/5dkfh36lq0QbzCq1TybbC
5bt8j0/4mQx2C8zDuP77EfjePqbFmvphQkiK1Qy7IqjMj4QFLsJ3cH8jwSNxJlWP
5Cl1y8PscusNk1seKEW9vafjX0rJhvY+9nsJb6d7FFbgO04rBO4xx4Qn8saEtY7A
Mn8aKbUlA1wMhMIKvRbPuW8DGHfquyRntYjirio0nKv30rBDzQf1y6nbQ3JPD8ly
z2bUWvDm1PBnBCBxl+rS6d3OH3Stls7dVAf1ze95QeKPpweIgWQBUMTOYSggGB9Z
ozDuQN6HfoFghNmhWAkR7QAriypc2xeiH76i1m5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PIGLelDdrCBm3wZY6NWVIYJT9r
dlyd8WdnVlw4DrLhB0hDq2GZsdibEGUG0MQPy4S82epjwm5ZFn3MC7hMFtM8TxFw
QXDlJGMjOUIP36BvK7eV/D6nat8A2Lzd1QKCAQEAxCt01jyC+1DzM0UCr5HmG/GK
j9ifAp8+o7YepAZ+/iS/YuYsUbV06x0Nc6GN7CJ9gRSYk7m2kIQuZEq1pKhXKSvU
Ns7nppTkaZbhizibVgeWYSkCT+/dvpAr+C8iQc1FGBDSp4pP4yLHTipxJJqM5tne
/15Me6lE/IUsIzs191TsQCsCmslxGQ6t0L+lV0eUQECeU2lVw9Kefxh1JqtsfBLP
qNFp7W9TNlEGWYIzN2V36+HcRtBY5cviKxvuMpJ31IOsgw64Xk5voqKPDSLod21w
uXgzW+fTraGP5Wkde8MdSsNaGzn2EEUatFtrykrwLCStkdei/jxyKcZttyWyVg==
-----END RSA PRIVATE KEY-----" >> id_rsa
sudo chmod 600 id_rsa
exit 0

114
monitor/setup/serverlite.sh Normal file
View File

@ -0,0 +1,114 @@
#!/bin/bash
echo "cap quyen"
chown root:root /etc/sudoers
sudo chmod +x /root/monitor/cache/clearcache.sh
sudo chmod +x /root/monitor/cache/restart_service.sh
sudo chmod +x /root/monitor/check/Check_engine
sudo chmod +x /root/monitor/launcher/S905X_BI
sudo chmod +x /root/monitor/setup/install_S905X_BI.sh
sudo chmod +x /root/monitor/setup/capture.sh
sudo chmod +x /root/monitor/setup/key.sh
sudo chmod +x /root/monitor/setup/serverlite.sh
#************install v4l***************
echo "================================ install v4l ================================"
sudo apt-get install -y v4l-utils
#************install tmux***************
echo "================================ install tmux ================================"
sudo apt install -y tmux
#*************install p7zip-full**************
echo "================================ install p7zip ================================"
sudo apt install -y p7zip-full
#
#****************rc.local*************
echo "================================ setup rc.local ================================"
echo '#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#/boot/fan.sh &
if [ ! -d /var/run/sshd ]; then
mkdir /var/run/sshd
chmod 0755 /var/run/sshd
systemctl restart ssh
fi
echo "Begin rc.local. Time restart: $time_begin" >> /root/monitor/log/rc_local.log
echo "nameserver 8.8.8.8" > /etc/resolv.conf
tmux new -d -s server_js 'node /root/BiFace_Server_Config_API/server.js'
exit 0' > /etc/rc.local
#
sudo apt -y update
sudo apt-get install -y apache2
cd /var/www
sudo chmod -R 0777 html
cd html
git clone http://gitea.beetai.com/dongpd/BiFace_Server_Lite.git
sudo chmod -R 0777 BiFace_Server_Lite
sudo apt-get install -y libapache2-mod-php php php-common php-curl php-dev php-gd php-pear php-imagick php-mysql php-xsl php-sqlite3 php-zip
echo "
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com
ServerAdmin webmaster@localhost
#DocumentRoot /var/www/html
DocumentRoot /var/www/html/BiFace_Server_Lite/web
<Directory /var/www/html/BiFace_Server_Lite/web>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
" > /etc/apache2/sites-available/000-default.conf
sudo a2enmod rewrite
sudo service apache2 restart
sudo echo "* * * * * php /var/www/html/BiFace_Server_Lite/yii sync" >> /var/spool/cron/crontabs/root
#
cd /root
git clone http://gitea.beetai.com/dongpd/BiFace_Server_Config_API.git
sudo apt-get install -y nodejs npm
sudo apt-get install -y nodejs-dev node-gyp libssl1.0-dev
sudo apt install -y npm
cd BiFace_Server_Config_API
npm install
sudo bash /etc/rc.local
echo "================================ setup serverlite done! ================================"
exit 0

127
monitor/setup/setup.sh Normal file
View File

@ -0,0 +1,127 @@
#!/bin/bash
#***************DNS****************************
echo "nameserver 8.8.8.8" > /etc/resolv.conf
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
sudo apt update && sudo apt upgrade -y
#***************set time****************************
echo "================================ Set timezon ================================"
unlink /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime
#*************cap quyen****************************
echo "================================ cap quyen ================================"
chown root:root /etc/sudoers
sudo chmod +x /root/monitor/cache/clearcache.sh
sudo chmod +x /root/monitor/cache/restart_service.sh
sudo chmod +x /root/monitor/check/Check_engine
sudo chmod +x /root/monitor/launcher/S905X_BI
sudo chmod +x /root/monitor/setup/install_S905X_BI.sh
sudo chmod +x /root/monitor/setup/capture.sh
sudo chmod +x /root/monitor/setup/key.sh
sudo chmod +x /root/monitor/setup/serverlite.sh
# ******************Autossh******************
#
echo "================================ install auto ssh ================================"
sudo apt install -y autossh
#*****************Screen********************
echo "================================ install screen ================================"
sudo apt install -y screen
chmod 777 /var/run/screen
#************capture***************
echo "================================ install lib capture ================================"
sudo apt install -y sshpass
sudo apt install -y gnome-screenshot
#************install v4l***************
echo "================================ install v4l ================================"
sudo apt-get install -y v4l-utils
#************install tmux***************
echo "================================ install tmux ================================"
sudo apt install -y tmux
#*************install p7zip-full**************
echo "================================ install p7zip ================================"
sudo apt install -y p7zip-full
#
#****************rc.local*************
echo "================================ setup rc.local ================================"
echo '#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
#/boot/fan.sh &
if [ ! -d /var/run/sshd ]; then
mkdir /var/run/sshd
chmod 0755 /var/run/sshd
systemctl restart ssh
fi
echo "Begin rc.local. Time restart: $time_begin" >> /root/monitor/log/rc_local.log
echo "nameserver 8.8.8.8" > /etc/resolv.conf
tmux new -d -s server_js 'node /root/BiFace_Server_Config_API/server.js'
exit 0' > /etc/rc.local
#
echo "network"
echo -e "#IP#\n\n###" >> /etc/network/interfaces
#
#*************setup service S905X_BI***************
echo "================================ setup autorun S905X_BI ================================"
cd /etc/systemd/system/
sudo rm S905X_BI.service
echo "[Unit]
Description=S905X_BI demo service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/env /root/monitor/launcher/S905X_BI
[Install]
WantedBy=multi-user.target" >> S905X_BI.service
sudo chmod 755 S905X_BI.service
#sudo systemctl start S905X_BI
#sudo systemctl enable S905X_BI
#*************Copy key ssh***************
echo "================================ copy key ================================"
sudo /root/monitor/setup/key.sh
rm /root/monitor/setup/key.sh
#
#*************setup schedule crontab**********
echo "================================ setup schedule crontab ================================"
echo "55 5 * * * sudo /root/monitor/cache/clearcache.sh" >> /var/spool/cron/crontabs/root
echo "50 5 * * * sudo /root/monitor/cache/restart_service.sh" >> /var/spool/cron/crontabs/root
#
#*************setup autologin***************
echo "================================ setup autologin ================================"
os_version=$(cat /etc/issue |grep "Ubuntu 18.04")
if [ -n "$os_version" ]; then
sudo apt-get install -y rng-tools
cd /etc/lightdm/lightdm.conf.d
echo "autologin-user=root
autologin-user-timeout=0
" >> 11-armbian.conf
fi
#
#*************setup serverlite**********
echo "================================ setup serverlite ================================"
sudo /root/monitor/setup/serverlite.sh
#
echo "================================ update ================================"
sudo apt-get -y update
#
reboot

View File

@ -0,0 +1,15 @@
#!/bin/bash
echo "================================ update serverlite ==============================="
cd /var/www
sudo chmod -R 0777 html
cd html
sudo rm -rf BiFace_Server_Lite
git clone http://gitea.beetai.com/dongpd/BiFace_Server_Lite.git
sudo chmod -R 0777 BiFace_Server_Lite
cd /root
sudo rm -rf BiFace_Server_Config_API
git clone http://gitea.beetai.com/dongpd/BiFace_Server_Config_API.git
cd BiFace_Server_Config_API
#npm install
echo "================================ update serverlite done!!! ==============================="
reboot

BIN
monitor/setup/winter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 KiB