遇到這樣的問題:-bash: /usr/local/java/jdk1.8.0_161/bin/java: cannot execute binary file: Exec format error
原因是: 在 64 位的 Linux 系統中安裝了 32 位的 JDK 環境,當前linux系統和所裝的kdl版本之間不一致導致。
最簡單的解決辦法如下:
# vim /etc/profile
在文檔最后,添加:
export PATH="/usr/local/src/java/bin:$PATH"
保存,退出,然后運行:
#source /etc/profile
vi /etc/profile
JAVA_HOME=/usr/local/jdk1.8.0_161
CLASSPATH=.:$JAVA_HOME/lib/tools.jar
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME CLASSPATH PATH
或者:
export JAVA_HOME=/usr/local/jdk1.8.0_161
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
對於用戶的SHELL初始化而言是先執行/etc/profile,再讀取文件/etc/environment.對整個系統而言是先執行/etc/environment。
/etc/enviroment --> /etc/profile --> $HOME/.profile -->$HOME/.env (如果存在)
/etc/profile 是所有用戶的環境變量, /etc/enviroment是系統的環境變量。 登陸系統時shell讀取的順序應該是 :
/etc/profile ->/etc/enviroment -->$HOME/.profile -->$HOME/.env
當用戶環境和系統環境有區別時候,會導致這個問題。
如果同一個變量在用戶環境(/etc/profile)和系統環境(/etc/environment)有不同的值那應該是以用戶環境為准。
這幾個文件的解釋如下:
(1)/etc/profile: 此文件為系統的每個用戶設置環境信息,當用戶第一次登錄時,該文件被執行. 並從/etc/profile.d目錄的配置文件中搜集shell的設置。
(2)/etc/bashrc: 為每一個運行bash shell的用戶執行此文件.當bash shell被打開時,該文件被讀取。
(3)~/.bash_profile: 每個用戶都可使用該文件輸入專用於自己使用的shell信息,當用戶登錄時,該文件僅僅執行一次!默認情況下,他設置一些環境變量,執行用戶的.bashrc文件。
(4)~/.bashrc: 該文件包含專用於你的bash shell的bash信息,當登錄時以及每次打開新的shell時,該該文件被讀取。
(5) ~/.bash_logout:當每次退出系統(退出bash shell)時,執行該文件. 另外,/etc/profile中設定的變量(全局)的可以作用於任何用戶,而~/.bashrc等中設定的變量(局部)只能繼承 /etc/profile中的變量,他們是"父子"關系。
(6)~/.bash_profile 是交互式、login 方式進入 bash 運行的~/.bashrc 是交互式 non-login 方式進入 bash 運行的通常二者設置大致相同,所以通常前者會調用后者。
如果前面的辦法還是沒能解決,則繼續向下看:
安裝依賴包
sudo apt-get install libc6-i386 lib32gcc1 lib32z1 lib32stdc++6 ia32-libs
強制升級更新
sudo apt-get update -y --force-yes && sudo apt-get upgrade -y --force-yes && sudo apt-get dist-upgrade -y --force-yes
定時傳圖:
lifeccp@raspberrypi:~/webapp/osprey $ crontab -l
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
# */2 * * * 1-5 /home/lifeccp/gateway/upload.sh >/dev/null 2>&1
# 10 8 * * 1-5 /home/lifeccp/gateway/upload.sh >/dev/null 2>&1
10 8 * * 1-5 cd /home/lifeccp/HAO/osprey;/home/lifeccp/gateway/upload10_EatYourOwnDogFood.sh >> /home/lifeccp/gateway/upload_cron_log_EatYourOwnDogFood.txt
# 10 8 * * 1-5 cd /home/lifeccp/gateway;/home/lifeccp/gateway/upload10_EatYourOwnDogFood.sh >> /home/lifeccp/gateway/upload_cron_log_EatYourOwnDogFood.txt
# */2 * * * 1-5 cd /home/lifeccp/gateway;/home/lifeccp/gateway/upload.sh >> /home/lifeccp/gateway/upload_cron_log.txt
# 05 15 * * 1-5 cd /home/lifeccp/gateway;/home/lifeccp/gateway/upload.sh >> /home/lifeccp/gateway/upload_cron_log.txt
# */2 * * * 1-5 java -jar /home/lifeccp/gateway/gw-emulator-0.0.11.jar 1 >> /home/lifeccp/gateway/upload_cron_log.txt
# 10 8 * * 1-5 /home/lifeccp/gateway/upload.sh >> /home/lifeccp/gateway/upload_cron_log.txt
/home/lifeccp/gateway/upload10_EatYourOwnDogFood.sh
#!/bin/sh
#java -jar /home/lifeccp/gateway/gw-emulator-0.0.11.jar 1
for i in $(seq 30); do
echo "\n ***********\n Number:$i \n*************** \n";
java -jar /home/lifeccp/gateway/gw-emulator-0.0.11.jar 1
sleep 120;
done;
設定數量
newBoxupdate.sh
#!/bin/sh
cd /home/lifeccp/webapp/osprey/
rm -rf /home/lifeccp/webapp/osprey/*
kill -9 `ps -ef | grep osprey | awk '{print $2}'`
scp lifeccp@192.168.21.11:/home/lifeccp/boxrelease/osprey/osprey.zip /home/lifeccp/webapp/
unzip /home/lifeccp/webapp/osprey.zip -d /home/lifeccp/webapp/osprey/
echo "Update SCUU ! Box Will restrt at 10 minutes..."
sudo reboot
