setup box version server 16.04

This commit is contained in:
HaiMD 2019-09-27 09:41:10 +07:00
parent 9a5fcdd920
commit 6e1ba65026
9 changed files with 205 additions and 0 deletions

1
monitor/CMS Submodule

@ -0,0 +1 @@
Subproject commit 3e96a1694e731019837496c0718f4634b60d9ff8

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

@ -0,0 +1,9 @@
#!/bin/bash
sync; echo 1 > /proc/sys/vm/drop_caches
systemctl restart S905X_BI
time_begin=$(date)
echo "$time_begin : clearcache & Restart service S905X & reboot!!" >> /root/monitor/log/cache.txt
echo "************************************" >> /root/monitor/log/cache.txt
sleep 3
reboot
exit 0

BIN
monitor/check/Check_engine Normal file

Binary file not shown.

BIN
monitor/launcher/S905X_BI 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

Binary file not shown.

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 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzd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+HcRtBY5cviKxvuMpJ31IOsgw64Xk5voqKPDSLod21w
uXgzW+fTraGP5Wkde8MdSsNaGzn2EEUatFtrykrwLCStkdei/jxyKcZttyWyVg==
-----END RSA PRIVATE KEY-----" >> id_rsa
sudo chmod 600 id_rsa
exit 0

13
monitor/setup/run_CMS.sh Normal file
View File

@ -0,0 +1,13 @@
#!/bin/bash
sudo chmod +x /root/monitor/CMS/run_cms.sh install.sh
sudo /root/monitor/CMS/install.sh
# ******************Autossh******************
#
sudo apt-get install -y autossh
#
echo "sleep 7
echo "Begin rc.local. Time restart: $time_begin" >> /root/monitor/log/rc_local.log
sudo /root/monitor/CMS/run_cms.sh" >> /etc/rc.local
exit 0

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

@ -0,0 +1,94 @@
#!/bin/bash
#***************set time****************************
echo "Set timezon"
unlink /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Ho_Chi_Minh /etc/localtime
#*************cap quyen****************************
echo "cap quyen"
sudo chmod +x /root/monitor/cache/clearcache.sh
sudo chmod +x /root/monitor/check/Check_engine
sudo chmod +x /root/monitor/launcher/S905X_BI
sudo chmod +x /root/monitor/CMS/install.sh
sudo chmod +x /root/monitor/CMS/run_cms.sh
sudo chmod +x /root/monitor/setup/run_CMS.sh install_S905X_BI.sh
sudo chmod +x /root/monitor/setup/key.sh
#******************CMS*************************
echo "install CMS"
sudo /root/monitor/CMS/install.sh
# ******************Autossh******************
#
echo "install auto ssh"
sudo apt-get install -y autossh
#*****************Screen********************
echo "install screen"
sudo apt-get install -y screen
chmod 777 /var/run/screen
#****************run_cms rc.local*************
echo "setup rc.local"
echo > /etc/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
sudo /root/monitor/CMS/run_cms.sh
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
#
#*************setup Opencv***************
echo "install Opencv"
cd /root/monitor/setup
tar -xvzf install_box-master.tar.gz
sudo chmod +x /root/monitor/setup/install_box/install_box.sh
sudo /root/monitor/setup/install_box/install_box.sh
#
#*************Copy key ssh***************
sudo /root/monitor/setup/key.sh
#
#*************setup schedule crontab**********
echo "33 3 * * * sudo /root/monitor/cache/clearcache.sh" >> /var/spool/cron/crontabs/root
sudo apt-get -y update
#
reboot