LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 07-19-2014, 07:18 AM   #1
stormbr
Member
 
Registered: Aug 2007
Location: Brazil
Distribution: Slackware 14.1 x86_64
Posts: 38

Rep: Reputation: 26
Problem in pkill arguments in 14.1


Today I was trying to send a usr2 signal to a process using pkill and it did not work:

pkill -signal usr2 someprocess
pkill: invalid session id: ignal

Has anyone seen this and have a solution?
 
Old 07-19-2014, 07:46 AM   #2
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
Quote:
pkill -signal usr2 someprocess
pkill: invalid session id: ignal
From the output the command is unable to interpret -signal, actually the command should look something like:

Code:
pkill -SIGUSR2 <process name>
Am not sure if USR2 signal is available, you can check that by running the following command:

Code:
kill -l
If it show that as available then you can use it.

Let me give you an example:

1. dd if=/dev/zero of=/dev/null & (it will start the DD process in background)
2. To kill it using pkill you can run: pkill -SIGKILL dd , where -SIGKILL is the signal, you don't have to use -signal to mention the signal, just use "-" with kill signal.

EDIT: I misunderstand usr2, Gazl is right it should be SIGUSR2

Last edited by T3RM1NVT0R; 07-19-2014 at 07:48 AM.
 
Old 07-19-2014, 07:46 AM   #3
GazL
LQ Veteran
 
Registered: May 2008
Posts: 7,007

Rep: Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137
You're misunderstanding its options. By -signal, it means
pkill -USR2 someprocess

or
pkill -SIGUSR2 someprocess

or even
pkill -12 someprocess

(though it's probably best to avoid using the numeric signal number (which can be subject to change from one UNIX arch to the the next).
 
1 members found this post helpful.
Old 07-19-2014, 07:58 AM   #4
stormbr
Member
 
Registered: Aug 2007
Location: Brazil
Distribution: Slackware 14.1 x86_64
Posts: 38

Original Poster
Rep: Reputation: 26
Thank you all for pointing my error. As GazL says I was misunderstanding the man page.

Once more thank you all for a prompt help.
 
Old 07-19-2014, 08:05 AM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 7,007

Rep: Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137Reputation: 5137
Either -USR2 or -SIGUSR2 will work, it just depends on how verbose you like to be.

It's unfortunate that the authors of pkill decided to use '-s' for session-id, where as the 'kill' command uses -s for specifying the signal. The UNIX/linux command line would be much nicer if we didn't have to remember these little inconsistencies all the time.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
pkill verbose? Xeratul Debian 6 08-25-2012 09:02 AM
PKILL process brianhickey18 Linux - Newbie 1 05-05-2010 06:38 AM
can't stop a process using pkill 2007fld Linux - Server 4 09-12-2007 08:13 AM
pkill ssh elohmrow Linux - Security 2 08-25-2005 09:51 AM
pgrep/pkill d3funct Linux - General 0 09-18-2001 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration