thao test pm2

This commit is contained in:
thaonguyen 2022-12-22 11:36:36 +07:00
commit b0aae1dbec
54 changed files with 818 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,6 @@
{
"camera": {
"translate_x": 0,
"traslate_y": 0
}
}

BIN
monitor/setup/datetime Normal file

Binary file not shown.

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

View File

@ -0,0 +1,5 @@
#!/bin/bash
scp -r * /usr/share/fonts/truetype/
fc-cache -f -v
echo "Setup font text done!"
exit 0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,93 @@
Copyright 2012 Google Inc. All Rights Reserved.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

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
ozDuQN6HfoFghNmhWAkR7QAriypc2xeiH76i1m5yEI5N30qJCyJ2EQASPWWJtpGF
5dkF1zZnOozn5p8tdM0cooscm7xMM49o4esN3l3jbaNLsMThe6o5uE9Z6Lq1240V
rpmrwP1d08vgzKFXn0iWwmEhgq3BSEWgLHJ5w5eQP2H0bsObbl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jyC+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

View File

@ -0,0 +1,17 @@
#!/bin/bash
#*************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
sudo chmod +x /root/monitor/setup/datetime
sudo chmod +x /root/monitor/setup/update_serverlite.sh
sudo chmod +x /root/monitor/setup/install_font_style/installfont.sh
exit 0

37
monitor/setup/pm2setup.sh Normal file
View File

@ -0,0 +1,37 @@
#!/bin/bash
# xoa run tmux server lite trong rc.local
# Cai dat PM2 run Server lite
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.bashrc
nvm install v16.18.1
npm install pm2 -g
cd /root/monitor/setup/
pm2 ecosystem
echo "
module.exports = {
apps : [
{
name: 'Server_lite',
cwd: '/root/BiFace_Server_Config_API',
script: 'server.js',
args: '',
interpreter: 'node',
restart_delay: 1000,
cron_restart: '0 0 * * *',
watch: false,
time: true
}
]
};
" > ecosystem.config.js
# Khởi chạy pm2 vs cấu hình vừa sửa
pm2 reload ecosystem.config.js
# Cài đặt pm2 khởi động cùng Win/Ubuntu
pm2 startup
# Copy-paste và chạy dòng script hiện trên màn hình
pm2 save
reboot
exit 0

229
monitor/setup/run_all.sh Normal file
View File

@ -0,0 +1,229 @@
#!/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
sudo chmod +x /root/monitor/setup/datetime
sudo chmod +x /root/monitor/setup/update_serverlite.sh
sudo chmod +x /root/monitor/setup/run_crontab.sh
sudo chmod +x /root/monitor/setup/install_font_style/installfont.sh
# CHANGE NAME BOX
echo "BIFACE" > /etc/hostname
# ******************Install Lib Soud******************
#sudo apt install sox libsox-fmt-all
sudo apt install -y sox libsox-fmt-all ffmpeg libnotify-bin
# ******************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
#****************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
time_begin=$(date)
echo "Begin rc.local. Time restart: $time_begin" >> /root/monitor/log/rc_local.log
echo "nameserver 8.8.8.8" > /etc/resolv.conf
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/
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**********
sudo /root/monitor/setup/serverlite.sh
#
#*************install p7zip-full**************
sudo apt install p7zip-full
# Disable ttyS0
systemctl stop serial-getty@ttyS0.service
systemctl daemon-reload
systemctl disable serial-getty@ttyS0.service
# Install font
sudo /root/monitor/setup/install_font_style/installfont.sh
#
sudo apt-get -y update
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
time_begin=$(date)
echo "Begin rc.local. Time restart: $time_begin" >> /root/monitor/log/rc_local.log
echo "nameserver 8.8.8.8" > /etc/resolv.conf
exit 0' > /etc/rc.local
#
echo "================================ update serverlite ==============================="
sudo apt -y update
sudo apt-get install -y apache2
cd /var/www
sudo chmod -R 0777 html
cd html
if [ "$1" = pro ]
then git clone -b BiFacePro2.0.1 http://gitea.beetai.com/dongpd/BiFace_Server_Lite
else git clone -b cloud http://gitea.beetai.com/dongpd/BiFace_Server_Lite
fi
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
cd /var/www/html/BiFace_Server_Lite
sudo chmod 0777 db/app.db
echo "================================ setup serverlite done! ================================"

View File

@ -0,0 +1,2 @@
#!/bin/bash
echo "run_crontab done!" > /root/monitor/setup/run_crontab.txt

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

@ -0,0 +1,117 @@
#!/bin/bash
#*************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
sudo chmod +x /root/monitor/setup/datetime
sudo chmod +x /root/monitor/setup/update_serverlite.sh
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
time_begin=$(date)
echo "Begin rc.local. Time restart: $time_begin" >> /root/monitor/log/rc_local.log
echo "nameserver 8.8.8.8" > /etc/resolv.conf
exit 0' > /etc/rc.local
#
echo "================================ update serverlite ==============================="
sudo apt -y update
sudo apt-get install -y apache2
cd /var/www
sudo chmod -R 0777 html
cd html
if [ "$1" = pro ]
then git clone -b BiFacePro2.0.1 http://gitea.beetai.com/dongpd/BiFace_Server_Lite
else git clone -b cloud http://gitea.beetai.com/dongpd/BiFace_Server_Lite
fi
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
cd /var/www/html/BiFace_Server_Lite
sudo chmod 0777 db/app.db
echo "================================ setup serverlite done! ================================"
exit 0

35
monitor/setup/setip.sh Normal file
View File

@ -0,0 +1,35 @@
#!/bin/bash
echo 'auto lo
iface lo inet interface
auto eth0' > /etc/network/interfaces
echo "Enter the type IPaddress"
read type
echo "iface eth0 inet $type" >> /etc/network/interfaces
if [ "$type" = static ]
then
echo "Enter the IP: "
read ipaddr
echo " address $ipaddr" >> /etc/network/interfaces
echo "Enter the netmask: "
read netmask
echo " netmask $netmask" >> /etc/network/interfaces
echo "Enter the gateway: "
read gateway
echo " gateway $gateway" >> /etc/network/interfaces
echo "Enter the dns-nameservers: "
read dns
echo " dns-nameservers $dns" >> /etc/network/interfaces
else echo "Setup IP success!!!"
fi
while true; do
read -p "Do you wish to reboot device?(y/n)" yn
case $yn in
[Yy]* ) reboot; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
exit 0

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

@ -0,0 +1,132 @@
#!/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
sudo chmod +x /root/monitor/setup/datetime
sudo chmod +x /root/monitor/setup/update_serverlite.sh
sudo chmod +x /root/monitor/setup/run_crontab.sh
sudo chmod +x /root/monitor/setup/install_font_style/installfont.sh
# CHANGE NAME BOX
echo "BIFACE" > /etc/hostname
# ******************Install Lib Soud******************
#sudo apt install sox libsox-fmt-all
sudo apt install -y sox libsox-fmt-all ffmpeg libnotify-bin
# ******************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
#****************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
time_begin=$(date)
echo "Begin rc.local. Time restart: $time_begin" >> /root/monitor/log/rc_local.log
echo "nameserver 8.8.8.8" > /etc/resolv.conf
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/
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**********
sudo /root/monitor/setup/serverlite.sh
#
#*************install p7zip-full**************
sudo apt install p7zip-full
# Disable ttyS0
systemctl stop serial-getty@ttyS0.service
systemctl daemon-reload
systemctl disable serial-getty@ttyS0.service
# Install font
sudo /root/monitor/setup/install_font_style/installfont.sh
#
sudo apt-get -y update
#
reboot

View File

@ -0,0 +1,33 @@
#!/bin/bash
#*************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
sudo chmod +x /root/monitor/setup/datetime
sudo chmod +x /root/monitor/setup/update_serverlite.sh
echo "================================ update serverlite ==============================="
cd /var/www
sudo chmod -R 0777 html
cd html
sudo rm -rf BiFace_Server_Lite
if [ "$1" = pro ]
then git clone -b BiFacePro2.0.1 http://gitea.beetai.com/dongpd/BiFace_Server_Lite
else git clone -b cloud http://gitea.beetai.com/dongpd/BiFace_Server_Lite
fi
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
cd /var/www/html/BiFace_Server_Lite
sudo chmod 0777 db/app.db
echo "================================ update serverlite done!!! ==============================="
reboot

BIN
monitor/setup/winter.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 940 KiB