add reboot after install node
This commit is contained in:
parent
9f9bb078eb
commit
7e7f7331dc
160
monitor/serverlite.sh
Executable file
160
monitor/serverlite.sh
Executable file
|
@ -0,0 +1,160 @@
|
|||
#!/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 litepro_dev 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
|
||||
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
|
||||
chmod +x ~/.nvm/nvm.sh
|
||||
. ~/.bashrc
|
||||
|
||||
nvm install 16
|
||||
|
||||
npm install pm2@5.4.2 -g n
|
||||
#sudo n stable
|
||||
pm2 install pm2-logrotate
|
||||
|
||||
cd BiFace_Server_Config_API
|
||||
npm install
|
||||
|
||||
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
|
||||
pm2 reload ecosystem.config.js
|
||||
|
||||
pm2 startup
|
||||
pm2 save
|
||||
|
||||
#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! ================================"
|
||||
|
||||
reboot
|
||||
exit 0
|
|
@ -113,7 +113,7 @@ git clone http://gitea.beetai.com/dongpd/BiFace_Server_Config_API.git
|
|||
|
||||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
|
||||
chmod +x ~/.nvm/nvm.sh
|
||||
source ~/.bashrc
|
||||
. ~/.bashrc
|
||||
|
||||
nvm install 16
|
||||
|
||||
|
@ -155,4 +155,6 @@ sudo bash /etc/rc.local
|
|||
cd /var/www/html/BiFace_Server_Lite
|
||||
sudo chmod 0777 db/app.db
|
||||
echo "================================ setup serverlite done! ================================"
|
||||
|
||||
reboot
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user