遇到这样的问题:-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
来源:oschina
链接:https://my.oschina.net/u/4369346/blog/4233714