Posts

Showing posts from March, 2017

Log file zimbra script

Image
The function read /var/log/zimbra.log use bash script. To input 1. FILE1=/var/log/zimbra.log 2. FOLDER=/tmp/test 2. NUMBER=/tmp/test/number.txt file To output TEMP_LOG=$FOLDER/tmp_zimbra.log Function f_check_folder to check folder existing yes or no. f_check_folder () {         if [[ -d $FOLDER ]]; then                 if [[ ! -s $NUMBER ]]; then                         touch $NUMBER                         echo 0 > $NUMBER                 fi         else                 mkdir -p $FOLDER                 touch $NUMBER                 echo 0 > $NUMBER         fi } Function f_get_log read /var/log/zimbra.log file f_get_log () {         NUM=`cat $NUMBER`         SUM=`expr "$NUM" + 1`         tail -n +"$SUM" $FILE1 > $TEMP_LOG         echo `wc -l < $FILE1` > $NUMBER }

curl: (35) SSL connect error

Image
How to solve problem " curl: (35) SSL connect error " For example, curl command to https://huuphan.com error and appear code 35 error as below [root@huupv httpdocs]# curl -v https://huuphan.com * About to connect() to huuphan.local port 443 (#0) *   Trying xxx.xxx.xxx.xxx... connected * Connected to huuphan.com (xxx.xxx.xxx.xxx) port 443 (#0) * Initializing NSS with certpath: sql:/etc/pki/nssdb *   CAfile: /etc/pki/tls/certs/ca-bundle.crt   CApath: none * NSS error -5990 * Closing connection #0 * SSL connect error curl: (35) SSL connect error Solve problem: To update curl and nss package For centos: # yum update curl nss For ubuntu: #apt-get update curl nss

xdotool − command−line X11 automation tool

Image
To install xdotool on ubuntu sudo apt-get update sudo apt-get install xdotool To install xdotool on fedora sudo yum install xdotool To display the current coordinates of the mouse cusrsor on linux #while true; do clear; xdotool getmouselocation; sleep 0.1; done The simple script for xdotool #!/bin/bash xdotool mousemove 343 755 click 1 sleep 2 while true do     xdotool mousemove 392 44 click 1     xdotool key "Return"     sleep 3     xdotool key Page_Up     sleep 3     xdotool mousemove 277 580 click 1     sleep 3     xdotool key Page_Down     sleep 3     xdotool mousemove 718 152 click 1     sleep 3     xdotool mousemove 46 482 click 1     sleep 3     xdotool mousemove 383 15 click 1     sleep 3 done Man xdotool http://man.cx/xdotool

How to owncloud 9 install ssl certificate centos 7

Image
How to owncloud 9 install ssl certificate centos 7. in the previous, how to install owncloud 9 in centos 7 To install  mod SSL #yum install mod_ssl To create new certificate #mkdir /etc/httpd/ssl #openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/httpd/ssl/owncloud.key -out /etc/httpd/ssl/owncloud.pem Adjusting /etc/httpd/conf.d/owncloud.conf file <VirtualHost *:80>     DocumentRoot /var/www/html/owncloud/     Redirect permanent / https://172.16.235.145/     <Directory /var/www/html/owncloud>         Options FollowSymLinks MultiViews         AllowOverride ALL         Order allow,deny         allow from all     </Directory> </VirtualHost> <VirtualHost *:443>     SSLEngine on     SSLCertificateFile /etc/httpd/ssl/owncloud.pem     SSLCertificateKeyFile /etc/httpd/ssl/owncloud.key     DocumentRoot /var/www/html/owncloud/     <Directory /var/www/html/owncloud>         Options FollowSymLinks MultiViews    

How to install owncloud 9 centos 7

Image
How to install owncloud 9 on centos 7. I'm use bash script to install owncloud 9 on centos 7. Links to below you maybe likes: How to install php7 on centos 6 How to install and configure redmine on centos 6 How to owncloud 9 install ssl certificate centos 7 How To Install the BIND DNS Server on CentOS 6 KeepAlived IP Failover on CentOS & Red Hat #!/bin/bash #Full Name: Phan Van Huu #My Blog: www.huuphan.com #How to install owncloud 9 centos 7 #To update centos 7 echo -e "Updating pack for centos 7\n" yum install -y vim wget yum -y update #To install Mariadb server for centos 7 echo -e "Installing MariaDB server for centos 7\n" yum install -y mariadb-server systemctl enable mariadb systemctl start mariadb #To set password root for MariaDB server echo -e "To set password root for MariaDB server\n" mysqld_safe --skip-grant-tables --skip-networking & 1>/dev/null mysql -u root -e 'FLUSH PRIVILEGES;' mysql -u root -e

How to Manage Mailbox Folder using zmmailbox command in Zimbra

Image
How to Manage Mailbox Folder using zmmailbox command in Zimbra. zmmailbox command for mailbox manager. It's useful for admin. in this post will brief how to get all folder, empty, delete subfolder/folder in zimbra. How to get all folder using zmmailbox command. [zimbra@mail ~]$ zmmailbox -z -m  [email protected] gaf The output:         Id  View      Unread   Msg Count  Path ----------  ----  ----------  ----------  ----------          1  unkn           0           0  /         16  docu           0           0  /Briefcase         10  appo           0           0  /Calendar         14  mess           0           0  /Chats          7  cont           0           0  /Contacts          6  mess           0           0  /Drafts         13  cont           0           3  /Emailed Contacts          2  mess           8          11  /Inbox         320  mess           0           0  /Inbox/New_Sub_folder          4  mess           0           0  /Junk        321  mess 

How to check zimbra account status

Image
How to check zimbra account status? How to know zimbra account status pending. How to know zimbra account status active, closed, locked, maintenance. In my post, one bash script get all zimbra account status and zmaccts commands another. Links to below you maybe likes: zimbra custom spamassassin rules How to create auto Bcc for Recipient mails for Zimbra 8.6 How to add spam filters on zimbra 8.6 How to create auto Bcc for sender mails for Zimbra 8.6 list accounts that has not logged in for the last x days in zimbra Method 1: To bash script use zimbra ldap check zimbra account status. #!/bin/bash # sed ':a;N;$!ba;s/\n/ /g' file : command line # :a create a label 'a' # N append the next line to the pattern space # $! if not the last line, ba branch (go to) label 'a' # s substitute, /\n/ regex for new line, / / by a space, /g global match (as many times as it can) # sed will loop through step 1 to 3 until it reach the last line, getting all l