Archive for July, 2018

Linux continuously execute multiple commands

Had previously been using a "shell + expect" combination。

Later in the course of,Expect more and more that this stuff is too far behind,The following reasons:

1. It has stopped issuing new official version;

2. Debug inefficient,In many cases the code to go with the way people think Mom。

then,It was later decided to use a scripting language python all done。

Practice has proved that,python development efficiency is very high,Indeed "rough fast fierce"。

stop,Digress。。。

In my Automation case in,You need to check whether a command is executed successfully (assuming command checklog,Successful return 0,Failure to return 1)。

Under normal circumstances,In the next sentence checklog,Direct "echo $?”,Judgment 0,1To。

but,Because the execution environment of the command prompt, 0 and 1,So pexpect not judge "echo $?"the result of。

later,Wondering wondering,My mind just emerge above knowledge points,I tried it,Fix the problem it is hereby Mark。

# Checklog expect the successful implementation
checklog && echo success
pexpect.expect(‘success’)

# Checklog execution failed expectations
checklog || echo failure
pexpect.expect(‘failure’)

Brush up the knowledge:
1. Command is the semicolon ";"Separated,These commands will be executed sequentially down;
2. Command is "&&"Separated,These commands will be executed sequentially down,Stop command execution encountered an error;
3. Commands are double pipe "||"Separated,These commands will be executed sequentially down,Stop command is successful encounter,All commands will not be executed later;

Comments off

linux network speed test

wget https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
chmod +x speedtest.py
./speedtest.py
Show
root@cn2:~# ./speedtest.py
Retrieving speedtest.net configuration…
Testing from QuadraNet (104.129.8.16)…
Retrieving speedtest.net server list…
Selecting best server based on ping…
Hosted by Interoute VDC (The Angels, THAT) [1.30 km]: 1.825 ms
Testing download speed…………………………………………………………………….. Downstream
Download: 97.70 Mbit/s
Testing upload speed…………………………………………………………………………………… Uplink
Upload: 94.82 Mbit/s

Comments off

semget: No space left on device DA can not start apache

This relates to semaphores on your system (you’ve run out). Run the following to clear them out:

ipcs | grep apache | awk ‘{print $2}’ > sem.txt
for i in `cat sem.txt`; do { ipcrm -s $i; }; done;

If this becomes a common occurance, then you may need to change your ipcs semaphore limits.
Set the following in your /etc/sysctl.conf:

kernel.msgmni = 1024
kernel.sem = 250 256000 32 1024

and reboot your system to load in those values.

Comments off

Protected: Screen some ip

This content is password protected. To view it please enter your password below:

Comments off

proxmox lxc change password

1.In the parent machine lxc-attach -n 101

2.passwd

3.exit

Comments off