Tag Archives: shell

Boot / etc/ rc.local What about invalidity? resolvent

Linux boot /etc/rc.local failure problem to provide three ways to solve the boot can not start the rc.local file problem, need friends refer to the following.

/etc/rc.local = /etc/rc.local

1, echo /etc/rc.local>

1, echo /etc/rc.local>; > /etc/profile & & Source /etc/profile

2>eboot

br>

2, reboot

echo /etc/rc.local>
echo /etc/rc.local> > ~/.bash_profile & & The source/etc/profile
Third:
in the/etc/rc3. D increase a startup scripts directory, and then restart the test, the content is as follows:

cat /etc/rc3.d/StartDefautRoute.sh

#! /bin/bash

# [email protected]

route add default gateway 192.168.1.1 dev xenbr0

Some commands cannot be executed in /etc/rc.local
To add a service that automatically runs when the system is started, simply add it to the /etc/rc.local script file. When the command or program is running without a path, for example:

 

#! /bin/bash
Distccd –user nobody –allow 10.10.98.0/24 –log-file=/var/log/distcc.log –verbose –daemon
loadavg-s 10.10.98.20>; /dev/null 2> & 1

Note that the distccd, loadavg commands are stored in /usr/local/bin/
When the system executes these commands, it will report an error and cannot execute properly!
Because the PATH environment variable was not fully initialized when the rc.local script was executed, the directory /usr/local/bin/ was added to the PATH environment variable only after /etc/profile was executed.

Executing commands in /usr/local/bin/directory in /etc/rc.local requires absolute path.

use cin.get () instead of system (“pause”) to avoid the flash of C + + programs

C + + compiled in a separate console program execution time, often a flash, can’t see the output results, in order to solve this problem, there are a lot of people use the system (” pause “) to suspend, but so are a lot of disadvantages, there are two reasons for
a: poor portability
2: consume resources is very big, in both Windows and Linux

Instead of using system(“pause”) to pause, you can use STD ::cin.get() or getchar()
. Why not system(“pause”)?


Let’s take a look at the flow of system(“pause”)
1: Pause your program
: Start the Shell in the sub-process
3>ind commands to execute and allocate memory for them
4: Wai>r input
5: Recluse m>y
6: End the Shell <>> 7: Continue your program>

To summarize, use STD ::cin.get() or getchar() to pause the execution of a C ++ program

PS: the original http://www.gidnetwork.com/b-61.html

Reproduced in: https://blog.51cto.com/zhanggx/1305045

Common errors and solutions of Qt development application under Ubuntu

Error: HelloWorld directly report error… :-1: error: cannot find -lGL
Reason: Lack of GL library
Sudo apt-get install libgl1-mesa-dev

I downloaded the latest version of QT-everywhere5.3.1, after porting it to the board directly created a Qt Quick program to run on the board, prompted the following error, can not find the solution online, ask how to solve this problem, thank you.
# ./qmlpng
QEglFSImx6Hooks will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
QQmlApplicationEngine failed to load component
qrc:///main.qml:1 module “QtQuick” is not installed
qrc:///main.qml:2 module “QtQuick.Controls” is not installed
qrc:///main.qml:1 module “QtQuick” is not installed
qrc:///main.qml:2 module “QtQuick.Controls” is not installed

Qrc :// main. QML :1 module “QtQuick” is not installed. $QTDIR/ QML will be installed in a folder if you install it.

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
Failed to create OpenGL context for format QsurfaceFormat (version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaB

Or try export QML_IMPORT_PATH=$QTDIR/ QML. It is not clear what it is, it may be different from project to project.

Export QML2_IMPORT_PATH=$QTDIR/ QML =$QTDIR/ QML
If this is not desired, you can override this via:
QEglFSImx6Hooks will set environment variable FB_MULTI_BUFFER=2 to enable double buffering and vsync.
If this is not desired, you can override this via: Export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1
=1

The original address: http://www.qtcn.org/bbs/read-htm-tid-56902.html

The shell script exits after an error is reported

When you’re doing DevOps or Continuous Integration or Continuous Delivery, you sometimes write shell scripts.
However, in the sequential execution of the shell script, there may be an intermediate stage that will report an error, and the execution will continue.
So how do you avoid the problem of quitting later execution when something goes wrong?
Reference code:

#!/bin/bash
set -o errexit

Add at the beginning of the set -o errexit can (or set -e )
To be closed when the set + o errexit (or set ) + e

””Device not found” error causes and Solutions

This is a common error you may encounter when using SQLite in Android development.
See this in conjunction with my other article, “ADB is not an internal or external command, nor is it an executable application.”
Executing ADB shell under CMD. It is likely that your ADB version is low. (You can view your version of ADB with the adb version command.)
Here’s how to solve this problem.
Open the Android SDK Manager in Eclipse, upgrade the SDK Platform, and download the Google USB Driver. As shown in the figure below:


At this point, the problem is solved by executing adb.exe again.

-bash: cannot create temp file for here-document: No space left on device

Phenomenon of 1.
[Bug MC-108686] – CD to a directory with TAB key

-bash: cannot create temp file for here-document: No space left on device

Reason 2.
Cannot create temporary file document, there is no space left on device (tells us disk space is full)
3. Clean up your files
df-h

du -sh /*

du -sh /root/*


3.4 Find the maximum file
(1) If the largest file is a log file or a backup file, this file can be cleared; (2) If you want to keep this maximum file, you have to expand the disk space.

The difference between single equal sign and double equal sign EQ in shell script

The single and double equal signs are arithmetic operators. “-eq” is a relational operator
Single and double equals
Equivalence in the conditional expression “[]” can be used to compare strings to strings or to compare integers to integers.
In the arithmetic expression “(())”, the single equal sign is the assignment arithmetic operator, and the double equal sign is the equality arithmetic operator.
“-eq”
The equality operator ‘-eq’ cannot be used in the arithmetic expression ‘(())’. It can only be used for equality comparisons of integer Integers.