2019-03-08

How to get the number of files in a folder as a variable?




Reference URL: https://stackoverflow.com/a/11132110/676104






How about:
count=$(find .. -maxdepth 1 -type f|wc -l)
echo $count
let count=count+1 # Increase by one, for the next file number
echo $count
Note that this solution is not efficient: it spawns sub shells for the find and wc commands, but it should work.

















linux avoid echo to email


Maybe only happen while the sh script contains echo lines, and also schedule to crontab.

Googled: linux avoid echo to email






Reference URL: https://www.cyberciti.biz/faq/disable-the-mail-alert-by-crontab-command/

Cron job example

Edit/Open your cron jobs, enter:
$ crontab -e
Append string >/dev/null 2>&1 to stop mail alert:
0 1 5 10 * /path/to/script.sh >/dev/null 2>&1
OR
0 1 5 10 * /path/to/script.sh > /dev/null
OR
0 * * * * /path/to/command arg1 > /dev/null 2>&1 || true
Save and close the file.

Set MAILTO variable

You can set MAILTO=”” variable at the start of your crontab file. This will also disable email alert. Edit/Open your cron jobs:
$ crontab -e
At the top of the file, enter:
MAILTO=""
Save and close the file.













Linux, let vs set




Reference URL: https://community.qlik.com/t5/QlikView-App-Development/let-and-set-difference/td-p/301811

celambarasan
MVP  
 MVP

let and set difference

Hi,
     Let: Calculates the expression assigned to it and sets the expression result to the variable.
     Set: Assigns the value(or expression which is after the equal sign) as it is without compute.
Example:
     Set vVar=2+3; //vVar has the expression 2+3 as value we have to compute it using $(vVar) which returns 5
     Let vVar=2+3;//vVar has the computed value 5
Hope it helps
Celambarasan





2019-03-07

Using mutt-1.4.2.3.tar.gz in CentOS 5.11 & 6.7


After install using: https://billson.blogspot.com/2019/03/centos-install-mutt-1423targz.html

Then execute: /opt/Programs/mutt/bin/mutt



Reference URL:

  1. http://sheet.shiar.nl/mutt (guides on keyboard)

    * to last message
  2. https://github.com/JoshuaEstes/CheatSheets/blob/master/mutt.md (flag message)

    w to choose flag a mail
    ctrl + N Jump to next thread
    ctrl + P Jump to previous thread
  3. https://unix.stackexchange.com/questions/152429/search-in-mutt-by-date-and-time(limit)

    press l, then key in string below:

    ~h 'you header to search' ~d 14/05/2018-31/05/2018
  4. https://bbs.archlinux.org/viewtopic.php?id=131257 (sort email)

    Hey, thanks. The first one did not work for me, but the second (alternate) did, so this would be the correct config:

    set sort=threads
    set sort_browser=date
    set sort_aux=reverse-last-date-received
  5. http://emileswarts.github.io/2011/06/16/reference-sheet-for-mutt-commands.html

    l – show messages matching a pattern
  6. https://unix.stackexchange.com/questions/91046/search-for-mail-content-with-mutt (search message content)

    manual:
    ~b EXPR         messages which contain EXPR in the message body

    eg:
    ~b 'Exception'



Scenario#01: Search emails, with subject contain 'Application error', between 2019 Jan 01-2019 Jan 31, message body contains 'Hello world'

press l, then key in string below:~h 'Application error' ~d 01/01/2019-31/01/2019 ~b 'Hello world'

Scenario#02: apply command to all tagged messages, Search email, key in search criteria, Tag all found message, "move" tagged messages to other mailbox(existing/new)

press l, then key in string below:
~h 'Application error' ~d 01/01/2019-31/01/2019 ~b 'Hello world'
press Shift + t
press enter again with predefined previous search criteria, to tag all found message.
press ;
key in s, then enter
then key in the target mailbox u want to "move"



Connect to a mail file:

mutt -f /var/spool/mail/john


https://www.tecmint.com/send-mail-from-command-line-using-mutt-command/

















2019-03-06

CentOS 5.11 install mutt-1.4.2.3.tar.gz


Searched: CentOS install mutt from "mutt-1.4.2.3.tar.gz"



Reference URL: http://www.voidcn.com/article/p-wjuavxxu-dw.html





wget ftp://ftp.mutt.org/pub/mutt/mutt-1.4.2.3.tar.gz
tar -xvzf mutt-1.4.2.3.tar.gz


Configuration: https://unix.stackexchange.com/questions/170099/how-use-mutt-to-manage-var-spool-mail-user
vim ~/.muttrc

set folder=/var/spool/mail
set mbox=+YourFile

set sort=threads
set sort_browser=date
set sort_aux=reverse-last-date-received





./configure --prefix=/opt/Programs/mutt



if hit issue: configure: error: no curses library found
sudo yum install ncurses-devel.x86_64







make

sudo make install

/opt/Programs/mutt/bin/mutt


















2019-03-05

VisualVM & ascii/UTF-8







Removed Java VisualVM

Java VisualVM is a tool that provides information about code running on a Java Virtual Machine. The jvisualvm tool was provided with JDK 6, JDK 7, and JDK 8.
Java VisualVM is no longer bundled with the JDK, but you can get it from the VisualVM open source project site.




Removed native2ascii Tool

The native2ascii tool has been removed from the JDK. Because JDK 9 and later releases support UTF-8 based properties resource bundles, the conversion tool for UTF-8 based properties resource bundles to ISO-8859-1 is no longer needed.
See UTF-8 Properties Files in Java Platform, Standard Edition Internationalization Guide.




Should I recompile my java projects when upgrade my JRE/JDK






Searched#1of2: is that necessary to recompile java for jdk security upgrade

Found:

  1. https://stackoverflow.com/questions/3846237/security-issues-of-compiling-against-older-jdks

    Aside from some very hypothetical niche situation that hasn't ever happened yet, the only thing that matters is the version with which the application is executed.

    I don't think there are any known security issues that have been "fixed" with @deprecated, because that wouldn't really be appropriate.

    There are two issues at play here:

    1) You can have your Java compiler produce binaries that are binary compatible with older versions. That affects the language features available to you.

    2) You can compile against the Java system libraries of an older version, and that will affect what methods/classes are available, as they are always adding new ones.

    But neither of these affects the security of your application. What matters is the runtime version with which the application is executed.

    Observe that security problems are fixed between updates, not the major versions, which introduce changes in the language itself. For example, Java 6 is currently at update 21. Java 6 update 19 fixed stuff that was vulnerable in Java 6 update 18.

    When Java 6 update 19 was released, updates were released for Java 1.5 and Java 1.4, to fix the same issues in Java 1.5 (update 24) and Java 1.4 (update 26). See the security baseline table here: http://www.oracle.com/technetwork/java/javase/6u19-141078.html




Searched#2of2: should I recompile classes when JDK security patch




Found:

  1. https://docs.oracle.com/en/java/javase/11/migrate/index.html#JSMIG-GUID-5657F44A-B2D7-4FB6-AAD7-295AC4533ABC



    Compile Your Application if Needed

















Google Referrals