What are the differences between SIGUSR1 and USR1

Viewed 834

Are there any differences between SIGUSR1 vs USR1 when it comes to killing a process

Ex

kill -SIGUSR1 {pid}

or

kill -USR1 {pid}

2 Answers

Matter of fact there is most definitely a difference. Certain process will only listen for USR1. An Example of this is nginx. Depending on the program that you are trying to kill make sure it has the proper listener for the signal that your sending with kill.

For instance if your doing a log rotation of nginx. Nginx will not listen for SIGUSR1. Found this out the hard way.

/var/log/nginx/*.log {
    daily
    rotate 10
    compress
    create 0640 www-data adm

    missingok
    notifempty

    # Signal the running nginx process exactly once to make it use the new log file.
    sharedscripts
    postrotate
        [ -f /var/run/nginx.pid ] && kill -USR1 $(cat /var/run/nginx.pid)
    endscript
}
Related