Sponsored Content
Top Forums UNIX for Beginners Questions & Answers How to kill printer PIDs except the spooler PID? Post 303024918 by RudiC on Friday 19th of October 2018 08:35:59 AM
Old 10-19-2018
Welcome to the forum.


I'm not sure I can follow your specification, as it sometimes seems to

- contradict your sample code / output (e.g. "no kills the spooler PPID "11814"" - are you talking of the process ID or the parent pr. ID?)
- refer to data NOT in the sample: 72:00:00
- use non-existent options (-e to pgrep; not found for pgrep on linux nor FreeBSD, only for pkill)


SHOULD you want to kill the processes that are childs to the lp root / parent process identified by PPID = 1, try

Code:
ps -eaf | awk 'BEGIN {printf "kill "} /lpsched$/ && $3 > 1 {printf "%s ", $2} END {printf ORS}' 
kill 22948 19332 29793 18598 26198 24981 13996 5802 24510 4585 26585 25739

If happy with the result, pipe the output through a shell (append | sh), or source it using "process substitution".
 

10 More Discussions You Might Find Interesting

1. Programming

printer status for print spooler: help

Hey people I am currently working on a print spooler for unix over a network. I need help regarding the status of the printer. Is there any way to know when the printer has finished a previous job, so that the next job from the queue can be processed. Also is there any other way to print other... (0 Replies)
Discussion started by: rage
0 Replies

2. Shell Programming and Scripting

KILL PID, intern should kill another PID.

Hi All, In my project i have two process runs in the back end. Once i start my project, and execute the command ps, i get below output: PID TTY TIME CMD 9086 pts/1 0:00 ksh 9241 pts/1 0:02 java 9240 pts/1 0:00 shell_script_bg java with 9241 PID is the main... (4 Replies)
Discussion started by: rkrgarlapati
4 Replies

3. UNIX for Advanced & Expert Users

KILL without PID

Hellow Experts i have one problem. i run one script in backgroun. and i want to kill that script with only script name..... so what's the solution.. for your info my script name is "testscript" n it contains "sleep 100" thanks.... (16 Replies)
Discussion started by: luckypower
16 Replies

4. Shell Programming and Scripting

When kill [pid] does not work...

Hi, On my Linux machine, using Bash, I sometimes run into a situation where doing the following does not seem to work at all. kermit@fastbox ~ $ ps -A | grep firefox-bin 5375 ? 00:06:57 firefox-bin <defunct> 5624 ? 00:00:00 firefox-bin kermit@fastbox ~ $ kill 5624... (7 Replies)
Discussion started by: kermit
7 Replies

5. Shell Programming and Scripting

Track and kill the PIDS

I have a script that conducts some SSH calls and I would like to capture the child info so that I can do a sleep and then a cleanup to make sure they do not stay out there as ghosts. I was told I could do something like this... #!/bin/sh for m = job1, job2, job3 x=1... (4 Replies)
Discussion started by: LRoberts
4 Replies

6. Shell Programming and Scripting

Kill a PID using script

Hi, I wrote a script to kill a process id. I am able to kill the PID only if I enter the root password in the middle of the execution because I did not run as root i.e after i run the script from the terminal, instead of killing directly, it is killing only after entering the pass when it... (12 Replies)
Discussion started by: rajkumarme_1
12 Replies

7. Shell Programming and Scripting

Need help to kill pids

Hi there !!! I am writing a script to kill the pids on different linux boxes :cool: the output of my command gives the pids running on that box, but how can I kill all the pids without looping? :confused: Code: ssh $i ps -fu $USER | grep ManServer | grep -v grep | awk '{print $2}' | kill ... (4 Replies)
Discussion started by: prany_cool
4 Replies

8. Shell Programming and Scripting

Kill PID with one liner

Hello Friends, I've been trying to write a one line which checks java processes and filter them for a user (testuser) and then check process arguments with PARGS command and then check if there is certain patterns exists in pargs output then kill the process. I have tried the following so... (2 Replies)
Discussion started by: EAGL€
2 Replies

9. Proxy Server

Samba kill the locked files from a useraccount by multiple smbd pids

Details Samba server: Release: 5.10 Kernel architecture: sun4u Application architecture: sparc Hardware provider: Sun_Microsystems Kernel version: SunOS 5.10 Generic_142909-17 Samba version: Samba version 3.5.6 Smb.conf file section Global: # smb.conf for Airbus Industries fuer... (0 Replies)
Discussion started by: Jean-Guillaume
0 Replies

10. AIX

Kill pid

I created a program to kill long running pid processes. I am getting the following error message: -f command cannot be found. I also want to count the number of pids that are killed and append the results to a text file. I am new to shell script programming. 1.The first part of code... (10 Replies)
Discussion started by: dellanicholson
10 Replies
lpana(1M)																 lpana(1M)

NAME
lpana - display LP spooler performance analysis information SYNOPSIS
dest] DESCRIPTION
displays LP spooler performance information, which system administrators can use to optimize the configuration of the entire spooler sys- tem. Options recognizes one option: Choose dest as the printer or the class of printers. If dest is a printer, the performance analysis information is dis- played for that specific printer. If dest is a class of printers, the performance analysis information is displayed for the printers that are members of the class. By default, displays the performance analysis information for all printers and/or classes. examines for the following items: Average waiting time from when job is spooled until start of printing. Standard Deviation for waiting time. Average printing time from start to end of job. Standard Deviation for printing time. Average of number of bytes printed per request. Standard Deviation for number of bytes. Sum of bytes printed for all requests (in kilobytes). Total number of requests since logging started. EXTERNAL INFLUENCES
Environment Variables determines the language in which messages are displayed. Setting causes the destination names exceeding 14 characters to be wrapped to multiple lines. This will ensure proper indentation of all the other displayed fields. WARNINGS
performs its operation on the local system only. AUTHOR
was developed by HP. FILES
SEE ALSO
lp(1), lpstat(1), lpadmin(1M), lpsched(1M). lpana(1M)
All times are GMT -4. The time now is 05:05 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy