Category Archives: Linux

Continuously print the file content

Use the command ‘tail’ to print the file contents, starting from the beginning of the file and print new contents continuously.

Posted in Linux | Comments Off on Continuously print the file content

[Linux] pkill command

I don’t know what’s going on. But we can use command “pkill” to delete those abnormal processes.

Reference: stackoverflow: How to kill all processes with a given partial name?

Posted in Linux | Comments Off on [Linux] pkill command

[Apache] wordpress permalink 404 issue

edit site conf (vim /etc/apache2/sites-available/pr.site.org.conf)

enable apache2 rewrite module

restart apache2 service

  Ref. [1] Victor Hung’s Diary: 「教學」解決 WordPress 固定網址設定 404 錯誤 [2] DigitalOcean: WordPress permalinks tried everything  

Posted in Apache, Ubuntu, WordPress | Leave a comment

[Docker] The crontab is not work in docker

Source: docker容器内cron不执行 vim /etc/pam.d/crond # The PAM configuration file for the cron daemon # # No PAM authentication called, auth modules not needed account required pam_access.so account sufficient pam_access.so account include password-auth session required pam_loginuid.so session sufficient pam_loginuid.so session include … Continue reading

Posted in Docker, Linux | Leave a comment

[Python] fix error while loading shared libraries: libpython2.7.so.1.0

error log: /opt/rh/python27/root/usr/bin/python: error while loading shared libraries: libpython2.7.so.1.0: cannot open shared object file: No such file or directory check libpython2.7.so.1.0 exist? find . -name ‘libpython2.7.so.1.0’ if the file was exist: edit the ldconfig config echo “/opt/rh/python27/root/usr/lib64” > /etc/ld.so.conf.d/python27.conf ldconfig … Continue reading

Posted in CentOS, Python | Leave a comment

[Shelll Script] check tomcat status

!/bin/bash tomcat7=$(ps -ef | grep tomcat | wc -l) echo ${#tomcat7} if [ ${#tomcat7} -gt 0 ]; then printf “tomcat is running\n” else printf “tomcat is not running\n” fi

Posted in Linux, Shell Script, Tomcat | Leave a comment

[Linux] more than one commands after the pipe

Source: How to merge and pipe results from two different commands to single command? bash test.sh || { curl -X POST ‘https://testurl’ -d ‘{ “data”: { “type”: “type”, “content”: “測試” } }’; exit 1; }

Posted in Linux | Leave a comment

[Linux] use tee to write log

Source: stackoverflow: How do I write stderr to a file while using “tee” with a pipe? sh test.sh 2>&1 | tee “test.log”

Posted in Linux | Leave a comment

Getting around Active Directory search size limit via ldapsearch

ldapsearch -E pr=500/noprompt -v -x -LLL -h host:port -D account -w password -b “DC=base,DC=dn” -s sub “(objectClass=user)” -E pr=500/noprompt : 500 results per page, no prompt -E pr=1000/prompt : 1000 results per page, show prompt Source: Getting around Active Directory … Continue reading

Posted in LDAP, Linux | Leave a comment

Linux command to get time in milliseconds

src: Linux command to get time in milliseconds date +”%T.%N” returns the current time with nanoseconds. date +”%T.%6N” returns the current time with nanoseconds rounded to the first 6 digits, which is microseconds. date +”%T.%3N” returns the current time with … Continue reading

Posted in Linux | Leave a comment