From 4bf101114ef54100a1a0e15b6449bbcc022a3bda Mon Sep 17 00:00:00 2001 From: yupmoon Date: Wed, 10 Dec 2014 11:15:05 +0800 Subject: [PATCH 1/3] yupmoon translating --- .../20141204 Readers' Choice Awards 2014--Linux Journal.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sources/news/20141204 Readers' Choice Awards 2014--Linux Journal.md b/sources/news/20141204 Readers' Choice Awards 2014--Linux Journal.md index b68509ee00..57c9418fb1 100644 --- a/sources/news/20141204 Readers' Choice Awards 2014--Linux Journal.md +++ b/sources/news/20141204 Readers' Choice Awards 2014--Linux Journal.md @@ -1,3 +1,6 @@ +translating by yupmoon + + Readers' Choice Awards 2014--Linux Journal ================================================================================ It's time for another Readers' Choice issue of Linux Journal! The format last year was well received, so we've followed suit making your voices heard loud again. I couldn't help but add some commentary in a few places, but for the most part, we just reported results. Please enjoy this year's Readers' Choice Awards! @@ -534,4 +537,4 @@ via: http://www.linuxjournal.com/rc2014 [a]:http://www.linuxjournal.com/users/shawn-powers [1]:http://www.linuxjournal.com/contact -[2]:http://www.linuxjournal.com/rc2014/coolest \ No newline at end of file +[2]:http://www.linuxjournal.com/rc2014/coolest From 0c763de017fb1843829ba82a967f9fdbb879bf6e Mon Sep 17 00:00:00 2001 From: DeadFire Date: Wed, 10 Dec 2014 16:16:48 +0800 Subject: [PATCH 2/3] =?UTF-8?q?20141210-1=20=E9=80=89=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...log client for remote logging on CentOS.md | 102 +++++++ ...backup plan for Debian with backupninja.md | 248 ++++++++++++++++++ ...Evernote from the command line on Linux.md | 149 +++++++++++ 3 files changed, 499 insertions(+) create mode 100644 sources/tech/20141210 How to configure rsyslog client for remote logging on CentOS.md create mode 100644 sources/tech/20141210 How to create a custom backup plan for Debian with backupninja.md create mode 100644 sources/tech/20141210 How to use Evernote from the command line on Linux.md diff --git a/sources/tech/20141210 How to configure rsyslog client for remote logging on CentOS.md b/sources/tech/20141210 How to configure rsyslog client for remote logging on CentOS.md new file mode 100644 index 0000000000..4e9817b7f3 --- /dev/null +++ b/sources/tech/20141210 How to configure rsyslog client for remote logging on CentOS.md @@ -0,0 +1,102 @@ +How to configure rsyslog client for remote logging on CentOS +================================================================================ +**rsyslog** is an open source utility widely used on Linux systems to forward or receive log messages via TCP/UDP protocols. rsyslog daemon can be configured in two scenarios. Configured as a log collector server, rsyslog daemon can gather log data from all other hosts in the network, which are configured to send their internal logs to the server. In another role, rsyslog daemon can be configured as a client which filters and sends internal log messages to either a local folder (e.g. /var/log) or a remote rsyslog server based on routing facility. + +Assuming that you already have a rsyslog server [up and running][1] on your network, this guide will show you how to set up a CentOS system to route its internal log messages to a remote rsyslog server. This will greatly improve your system's disk usage, especially if you don't have a separate large partition dedicated for /var directory. + +### Step One: Install Rsyslog Daemon ### + +On CentOS 6 and 7, rsyslog daemon comes preinstalled. To verify that rsyslog is installed on your CentOS system, issue the following command: + + # rpm -qa | grep rsyslog + # rsyslogd -v + +![](https://farm8.staticflickr.com/7502/15988316295_ac2e07e7f3_z.jpg) + +If for some reason rsyslog daemon is missing on your system, issue the following command to install it: + + # yum install rsyslog + +### Step Two: Configure Rsyslog Daemon as a Client ### + +The next step is to transform your CentOS machine into a rsyslog client which sends all of its internal log messages to the central remote log server. + +To do so, open the main rsyslog configuration file located in /etc path with your favorite text editor: + + # nano /etc/rsyslog.conf + +After the file is opened for editing, you need to add the following statement at the bottom of the file. Replace the IP address with your remote rsyslog server's IP address. + + *.* @192.168.1.25:514 + +The above statement tells rsyslog daemon to route every log message from every facility on the system to the remote rsyslog server (192.168.1.25) on UDP port 514. + +If for some reasons you need a more reliable protocol like TCP, and the rsyslog server is configured to listen for TCP connections, you must add an extra @ character in front of the remote host's IP address as in the below excerpt: + + *.* @@192.168.1.25:514 + +Note that you can also replace the IP address of the rsyslog server with its DNS name (FQDN). + +If you want to forward log messages from a specific facility only, let's say kernel facility, then you can use the following statement in your rsyslog configuration file. + + kern.* @192.168.1.25:514 + +Once you have modified the configuration, you need to restart the daemon to activate the change: + +**On CentOS 7:** + + # systemctl restart rsyslog.service + +**On CentOS 6:** + + # service rsyslog restart + +In another scenario, let's assume that you have installed an application named "foobar" on your machine, which generates logs to /var/log/foobar.log file. Now you want to direct only its logs to a remote rsyslog server. This can be achieved by loading imfile module in the rsyslog configuration as follows. + +First load the imfile module. This must be done just once. + + module(load="imfile" PollingInterval="5") + +Then specify the path to the log file that the imfile module should monitor: + + input(type="imfile" + File="/var/log/foobar.log" + Tag="foobar" + Severity="error" + Facility="local7") + +Finally, direct local7 facility to the remote rsyslog server: + + local7.* @192.168.1.25:514 + +Don't forget to restart rsyslog daemon. + +### Step Three: Enable Rsyslog Daemon to Auto-start ### + +To automatically start rsyslog client after every system reboot, run the following command to enable it system-wide: + +**On CentOS 7:** + + # systemctl enable rsyslog.service + +**On CentOS 6:** + + # chkconfig rsyslog on + +### Summary ### + +In this tutorial I demonstrated how to turn a CentOS system into rsyslog client to force it to send its log messages to a remote rsyslog server. Here I assume that the connection between a rsyslog client and rsyslog server is secure (e.g., within corporate network protected by a firewall). Under any circumstances do not configure a rsyslog client to forward log messages over insecure networks or, especially, over the Internet as the syslog protocol is a clear-text protocol. For secure transmission, consider encrypting syslog messages using [TLS/SSL][2]. + +-------------------------------------------------------------------------------- + +via: http://xmodulo.com/configure-rsyslog-client-centos.html + +作者:[Caezsar M][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 + +[a]:http://xmodulo.com/author/caezsar +[1]:http://xmodulo.com/configure-syslog-server-linux.html +[2]:http://www.rsyslog.com/doc/rsyslog_tls.html \ No newline at end of file diff --git a/sources/tech/20141210 How to create a custom backup plan for Debian with backupninja.md b/sources/tech/20141210 How to create a custom backup plan for Debian with backupninja.md new file mode 100644 index 0000000000..cfe50df9d7 --- /dev/null +++ b/sources/tech/20141210 How to create a custom backup plan for Debian with backupninja.md @@ -0,0 +1,248 @@ +How to create a custom backup plan for Debian with backupninja +================================================================================ +Backupninja is a powerful and highly-configurable backup tool for Debian based distributions. In the [previous tutorial][1], we explored how to install backupninja and how to set up two backup actions for the program to perform. However, we should note that those examples were only "the tip of the iceberg," so to speak. In this post we will discuss how to leverage custom handlers and helpers that allow this program to be customized in order to accomplish almost any backup need that you can think of. + +And believe me - that is not an overstatement, so let's begin. + +### A Quick Review of Backupninja ### + +One of backupninja's distinguishing features is the fact that you can just drop plain text configuration or action files in /etc/backup.d, and the program will take care of the rest. In addition, we can write custom scripts (aka "handlers") and place them in /usr/share/backupninja to handle each type of backup action. Furthermore, we can have these scripts be executed via ninjahelper's ncurses-based interactive menus (aka "helpers") to guide us to create the configuration files we mentioned earlier, minimizing the chances of human error. + +### Creating a Custom Handler and Helper ### + +Our goal in this case is to create a script to handle the backup of chosen home directories into a tarball with either gzip or bzip2 compression, excluding music and video files. We will simply name this script home, and place it under /usr/backup/ninja. + +Although you could achieve the same objective with the default tar handler (refer to /usr/share/backupninja/tar and /usr/share/backupninja/tar.helper), we will use this approach to show how to create a useful handler script and ncurses-based helper from scratch. You can then decide how to apply the same principles depending on your specific needs. + +Note that since handlers are sourced from the main script, there is no need to start with #!/bin/bash at the top. + +Our proposed handler (/usr/share/backupninja/home) is as follows. It is heavily commented for clarification. The getconf function is used to read the backup action's configuration file. If you specify a value for a variable here, it will override the corresponding value present in the configuration file: + + # home handler script for backupninja + + # Every backup file will identify the host by its FQDN + getconf backupname + + # Directory to store backups + getconf backupdir + + # Default compression + getconf compress + + # Include /home directory + getconf includes + + # Exclude files with *.mp3 and *.mp4 extensions + getconf excludes + + # Default extension for the packaged backup file + getconf EXTENSION + + # Absolute path to date binary + getconf TAR `which tar` + + # Absolute path to date binary + getconf DATE `which date` + + # Chosen date format + DATEFORMAT="%Y-%m-%d" + + # If backupdir does not exist, exit with fatal error + if [ ! -d "$backupdir" ] + then + mkdir -p "$backupdir" || fatal "Can not make directory $backupdir" + fi + + # If backupdir is not writeable, exit with fatal error as well + if [ ! -w "$backupdir" ] + then + fatal "Directory $backupdir is not writable" + fi + + # Set the right tar option as per the chosen compression format + case $compress in + "gzip") + compress_option="-z" + EXTENSION="tar.gz" + ;; + "bzip") + compress_option="-j" + EXTENSION="tar.bz2" + ;; + "none") + compress_option="" + ;; + *) + warning "Unknown compress filter ($tar_compress)" + compress_option="" + EXTENSION="tar.gz" + ;; + esac + + # Exclude the following file types / directories + exclude_options="" + for i in $excludes + do + exclude_options="$exclude_options --exclude $i" + done + + # Debugging messages, performing backup + debug "Running backup: " $TAR -c -p -v $compress_option $exclude_options \ + -f "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`".$EXTENSION" \ + $includes + + # Redirect standard output to a file with .list extension + # and standard error to a file with .err extension + $TAR -c -p -v $compress_option $exclude_options \ + -f "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`".$EXTENSION" \ + $includes \ + > "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`.list \ + 2> "$backupdir/$backupname-"`$DATE "+$DATEFORMAT"`.err + + [ $? -ne 0 ] && fatal "Tar backup failed" + +Next, we will create our helper file (/usr/share/backupninja/home.helper) so that our handlers shows up as a menu in ninjahelper: + + # Backup action's description. Separate words with underscores. + HELPERS="$HELPERS home:backup_of_home_directories" + + home_wizard() { + home_title="Home action wizard" + + backupname=`hostname --fqdn` + + # Specify default value for the time when this backup actions is supposed to run + inputBox "$home_title" "When to run this action?" "everyday at 01" + [ $? = 1 ] && return + home_when_run="when = $REPLY" + + # Specify default value for backup file name + inputBox "$home_title" "\"Name\" of backups" "$backupname" + [ $? = 1 ] && return + home_backupname="backupname = $REPLY" + backupname="$REPLY" + + # Specify default directory to store the backups + inputBox "$home_title" "Directory where to store the backups" "/var/backups/home" + [ $? = 1 ] && return + home_backupdir="backupdir = $REPLY" + + # Specify default values for the radiobox + radioBox "$home_title" "Compression" \ + "none" "No compression" off \ + "gzip" "Compress with gzip" on \ + "bzip" "Compress with bzip" off + [ $? = 1 ] && return; + result="$REPLY" + home_compress="compress = $REPLY " + + REPLY= + while [ -z "$REPLY" ]; do + formBegin "$home_title: Includes" + formItem "Include:" /home/gacanepa + formDisplay + [ $? = 0 ] || return 1 + home_includes="includes = " + for i in $REPLY; do + [ -n "$i" ] && home_includes="$home_includes $i" + done + done + + REPLY= + while [ -z "$REPLY" ]; do + formBegin "$home_title: Excludes" + formItem "Exclude:" *.mp3 + formItem "Exclude:" *.mp4 + # Add as many “Exclude” text boxes as needed to specify other exclude options + formItem "Exclude:" + formItem "Exclude:" + formDisplay + [ $? = 0 ] || return 1 + home_excludes="excludes = " + for i in $REPLY; do + [ -n "$i" ] && home_excludes="$home_excludes $i" + done + done + + # Save the config + get_next_filename $configdirectory/10.home + cat > $next_filename < Date: Wed, 10 Dec 2014 20:50:34 +0800 Subject: [PATCH 3/3] su-kaiyao translated --- ...Commands to Check Memory Usage in Linux.md | 131 ---------------- ...Commands to Check Memory Usage in Linux.md | 147 ++++++++++++++++++ 2 files changed, 147 insertions(+), 131 deletions(-) delete mode 100644 sources/tech/20141205 10 free Commands to Check Memory Usage in Linux.md create mode 100644 translated/tech/20141205 10 free Commands to Check Memory Usage in Linux.md diff --git a/sources/tech/20141205 10 free Commands to Check Memory Usage in Linux.md b/sources/tech/20141205 10 free Commands to Check Memory Usage in Linux.md deleted file mode 100644 index 510e4d571a..0000000000 --- a/sources/tech/20141205 10 free Commands to Check Memory Usage in Linux.md +++ /dev/null @@ -1,131 +0,0 @@ -[su-kaiyao]translating - -10 ‘free’ Commands to Check Memory Usage in Linux -================================================================================ -**Linux** is one of the most popular open source operating system and comes with huge set of commands. The most important and single way of determining the total available space of the **physical memory** and **swap memory** is by using “**free**” command. - -The Linux “**free**” command gives information about total used and available space of **physical memory** and **swap memory** with **buffers** used by kernel in **Linux/Unix** like operating systems. - -![10 Linux Free Command Examples](http://www.tecmint.com/wp-content/uploads/2012/09/Linux-Free-commands.png) - -This article provides some useful examples of “**free**” commands with options, that might be useful for you to better utilize memory that you have. - -### 1. Display System Memory ### - -Free command used to check the used and available space of **physical memory** and **swap memory** in **KB**. See the command in action below. - - # free - - total used free shared buffers cached - Mem: 1021628 912548 109080 0 120368 655548 - -/+ buffers/cache: 136632 884996 - Swap: 4194296 0 4194296 - -### 2. Display Memory in Bytes ### - -Free command with option **-b**, display the size of memory in **Bytes**. - - # free -b - - total used free shared buffers cached - Mem: 1046147072 934420480 111726592 0 123256832 671281152 - -/+ buffers/cache: 139882496 906264576 - Swap: 4294959104 0 4294959104 - -### 3. Display Memory in Kilo Bytes ### - -Free command with option **-k**, display the size of memory in (KB) **Kilobytes**. - - # free -k - - total used free shared buffers cached - Mem: 1021628 912520 109108 0 120368 655548 - -/+ buffers/cache: 136604 885024 - Swap: 4194296 0 4194296 - -### 4. Display Memory in Megabytes ### - -To see the size of the memory in **(MB) Megabytes** use option as **-m**. - - # free -m - - total used free shared buffers cached - Mem: 997 891 106 0 117 640 - -/+ buffers/cache: 133 864 - Swap: 4095 0 4095 - -### 5. Display Memory in Gigabytes ### - -Using **-g** option with free command, would display the size of the memory in **GB(Gigabytes)**. - - # free -g - total used free shared buffers cached - Mem: 0 0 0 0 0 0 - -/+ buffers/cache: 0 0 - Swap: 3 0 3 - -### 6. Display Total Line ### - -Free command with -t option, will list the total line at the end. - - # free -t - - total used free shared buffers cached - Mem: 1021628 912520 109108 0 120368 655548 - -/+ buffers/cache: 136604 885024 - Swap: 4194296 0 4194296 - Total: 5215924 912520 4303404 - -### 7. Disable Display of Buffer Adjusted Line ### - -By default the free command display “**buffer adjusted**” line, to disable this line use option as -o. - - # free -o - - total used free shared buffers cached - Mem: 1021628 912520 109108 0 120368 655548 - Swap: 4194296 0 4194296 - -### 8. Dispaly Memory Status for Regular Intervals ### - -The -s option with number, used to update free command at regular intervals. For example, the below command will update free command every 5 seconds. - - # free -s 5 - - total used free shared buffers cached - Mem: 1021628 912368 109260 0 120368 655548 - -/+ buffers/cache: 136452 885176 - Swap: 4194296 0 4194296 - -### 9. Show Low and High Memory Statistics ### - -The -l switch displays detailed high and low memory size statistics. - - # free -l - - total used free shared buffers cached - Mem: 1021628 912368 109260 0 120368 655548 - Low: 890036 789064 100972 - High: 131592 123304 8288 - -/+ buffers/cache: 136452 885176 - Swap: 4194296 0 4194296 - -### 10. Check Free Version ### - -The -V option, display free command version information. - - # free -V - - procps version 3.2.8 - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/check-memory-usage-in-linux/ - -作者:[Ravi Saive][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/admin/ diff --git a/translated/tech/20141205 10 free Commands to Check Memory Usage in Linux.md b/translated/tech/20141205 10 free Commands to Check Memory Usage in Linux.md new file mode 100644 index 0000000000..fe56c55f93 --- /dev/null +++ b/translated/tech/20141205 10 free Commands to Check Memory Usage in Linux.md @@ -0,0 +1,147 @@ +10个检测Linux内存使用情况的‘free’命令 +=== + +**Linux**是最有名的开源操作系统之一,它拥有着极其巨大的指令集。确定**物理内存**和**交换内存**所有可用空间的最重要,也是唯一的方法是使用“**free**”命令。 + +Linux “**free**”命令通过给出**Linux/Unix**操作系统中内核已使用的**buffers**情况,来提供**物理内存**和**交换内存**的总使用量和可用量。 + +![10 Linux Free Command Examples](http://www.tecmint.com/wp-content/uploads/2012/09/Linux-Free-commands.png) + +这篇文章提供一些带有参数选项的“**free**”命令,这些命令对于你更好地利用你的内存会有帮助。 + +### 1. 显示你的系统内存 ### + +free命令用于检测**物理内存**和**交换内存**已使用量和可用量(单位为**KB**)。下面演示命令的使用情况。 + + # free + + total used free shared buffers cach +ed + Mem: 1021628 912548 109080 0 120368 6555 +48 + -/+ buffers/cache: 136632 884996 + Swap: 4194296 0 4194296 + +### 2. 以字节为单位显示内存 ### + +加上**-b**参数的free命令,以**字节**为单位显示内存的大小。 + + # free -b + + total used free shared buffers cach +ed + Mem: 1046147072 934420480 111726592 0 123256832 6712811 +52 + -/+ buffers/cache: 139882496 906264576 + Swap: 4294959104 0 4294959104 + +### 3. 以千字节为单位显示内存 ### + +加上**-k**参数的free命令,以(KB)**千字节**为单位显示内存大小。 + + # free -k + + total used free shared buffers cach +ed + Mem: 1021628 912520 109108 0 120368 655548 + -/+ buffers/cache: 136604 885024 + Swap: 4194296 0 4194296 + +### 4. 以兆字节为单位显示内存 ### + +想以**(兆字节)**显示内存大小,使用**-m**参数。 + + # free -m + + total used free shared buffers cach +ed + Mem: 997 891 106 0 117 6 +40 + -/+ buffers/cache: 133 864 + Swap: 4095 0 4095 + +### 5. 以千兆字节为单位显示内存 ### + +使用**-g**为参数,将会以**GB(千兆字节)**为单位显示内存大小。 + + # free -g + total used free shared buffers cached + Mem: 0 0 0 0 0 + 0 + -/+ buffers/cache: 0 0 + Swap: 3 0 3 + +### 6. 显示总计行 ### + +加上-t选项,将会在屏幕最后列出总计一行。 + + # free -t + + total used free shared buffers cache +d + Mem: 1021628 912520 109108 0 120368 6555 +48 + -/+ buffers/cache: 136604 885024 + Swap: 4194296 0 4194296 + Total: 5215924 912520 4303404 + +### 7. 关闭显示缓冲区调整一行 ### + +默认情况下,free命令是显示“**缓冲区调整**”一行的,为了关闭显示,可以加上-o参数。 + + # free -o + + total used free shared buffers cache +d + Mem: 1021628 912520 109108 0 120368 6555 +48 + Swap: 4194296 0 4194296 + +### 8. 定期时间间隔更新内存状态 ### + +-s选项加上一个整数,用来在定期时间间隔内更新free命令。举个例子,下面的命令将会在每5秒更新一个free命令。 + + # free -s 5 + + total used free shared buffers cach +ed + Mem: 1021628 912368 109260 0 120368 6555 +48 + -/+ buffers/cache: 136452 885176 + Swap: 4194296 0 4194296 + +### 9. 显示底和高内存统计信息 ### + +-l选项显示了具体的高和低内存的使用统计情况。 + + # free -l + + total used free shared buffers cach +ed + Mem: 1021628 912368 109260 0 120368 6555 +48 + Low: 890036 789064 100972 + High: 131592 123304 8288 + -/+ buffers/cache: 136452 885176 + Swap: 4194296 0 4194296 + +### 10. 检查free命令版本 ### + +-V选项,显示free命令版本信息。 + + # free -V + + procps version 3.2.8 + +--- + +via: http://www.tecmint.com/check-memory-usage-in-linux/ + +作者:[Ravi Saive][a] +译者:[su-kaiyao](https://github.com/su-kaiyao) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中> +国](http://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/admin/