A handy tip before restarting the nginx is to test …

Comment on How to install nginx webserver from source on Debian Linux / Install Latest Nginx on Debian by admin.

A handy tip before restarting the nginx is to test if the conf file is well configured, here is how:

debian:~# nginx -t -c /etc/nginx/nginx.conf

Recent Comments by admin

Display Content of SSL certificate .pem file with openssl command
One other tip here is How to generate a new .pem assuming you have .key and .pem files already generated already with command:

 openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout ejabberd.key -out ejabberd.crt

Once the whatever.key and whatever.pem files are existing just cat each of them to prepare a new .pem file

cat whatever.pem >> whatever-new.key
cat whatever.key >> whatever-new.pem

Now you can use your whatever-new.pem with some service and enjoy.

How to delete million of files on busy Linux servers (Work out Argument list too long)

If you need to delete a pattern contained in all files (e.g. delete just some of the files) you can use this command: cd /path/to/directory/; find . -type f -mtime +5 -print |grep -i 'WF_LOG_'| xargs rm -f

Squid Proxy log timestamp human readable / Convert and beautify Proxy unixtime logs in human-readable form howto
Other useful thing is the Convert Nagios Log Timestamp to Human Readable Format

Below is how

[root@foo1 ~]# cat /usr/local/nagios/var/nagios.log | perl -pe 's/(d+)/localtime($1)/e'

Optimizing Linux TCP/IP Networking to increase Linux Servers Performance
More useful sysctl options under some circumstances:


Prevent rsync cronjob to run multiple times via cronjob on Linux
Another way I just red on a blog is as follows:


$ crontab -l
* * * * * /path/to/cron.sh

The command above will, just as the first example, execute our PHP script every minute through a bash script. To prevent it from overlapping, it can also be changed to this.

$ crontab -l
* * * * * /usr/bin/pgrep -f /path/to/cron.sh > /dev/null 2> /dev/null || /path/to/cron.sh

The pgrep command will return false if it does not find a running process matching the first argument, /path/to/cron.sh. If it returns false, it'll process the second part of the OR comparison (the double vertical line, ||). If the running process was found, pgrep will return the Process ID (PID) and Bash will not continue to the second part of the OR statement since the first already returned true.

The trick here is to use very unique scriptnames. If the name is too generic (such as "cron.sh"), pgrep may return Process IDs from other running cron jobs and not execute the cron you wanted.

Share this on:

No Responses to “A handy tip before restarting the nginx is to test …”

  1. Mr WordPress says:
    Unknown Unknown Unknown Unknown

    Hi, this is a comment.
    To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.

    View CommentView Comment