ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Yura Kalinichenko <yuk@iceb.vinnitsa.com>
To: AltLinux Community Maillist <community@altlinux.ru>
Subject: Re: Re[2]: [Comm] OpenOffice print troubles
Date: 21 Oct 2004 20:21:29 +0300
Message-ID: <1098379289.2871.42.camel@iceb> (raw)
In-Reply-To: <1098347140.13973.denwebmail-26@dead-mustdie@nm.ru>

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

В Чтв, 21.10.2004, в 11:25, dm написал:

> Уточните, пожалуйста: скрипт, о котором Вы упомянули, не работает именно в 
> _дистрибутиве_ M2.4, или это связано с ядром 2.6?

В аттаче - исправленный скрипт, который работает и в Master 2.4, и в
предыдущих дистрибутивах. Только настройте sudo, как описано в
комментариях. С ядром 2.6 я пока не работаю, но врядли там в этом плане
что-то повлияет.

-- 
Yura Kalinichenko

[-- Attachment #2: lprm --]
[-- Type: text/x-sh, Size: 1854 bytes --]

#!/bin/sh
#
# This is a temporary replacement for buggy lprm from spooling system CUPS.
# Fixed bug is: original can't really stop active job
# Autor: Yura Kalinichenko <yuk@iceb.vinnitsa.com>
#
# Additional requirements:
# 	all users must have permission for `kill' as user `lp' and
#       see any processes of "printer drivers".
# 	For example, you can enter in file `sudoers' next strings:
#
# Cmnd_Alias    PRINTER=/bin/kill,\
#               /bin/ps --no-headers -C *\:/dev/*lp* --format pid\,command
# ALL		ALL=(root) NOPASSWD: PRINTER
#
# Yes, now every user can kill any process, but...
#

CMDLINE=`getopt -o P: -- "$@"`
if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 255 ; fi
eval set -- "$CMDLINE"

while true ; do
	case "$1" in
	-P) PRINTER=$2
            shift 2
            ;;
        --) shift ; break
            ;;
        esac
done

if [ -z "$PRINTER" ]; then
   PRINTER=`lpstat -d | sed -e "s/system default destination: //"`
   if [ -z "$PRINTER" ]; then
      echo "No default printer - use  \"-P printer_name\"" > /dev/stderr
      exit 255
   fi
fi

jobs=$*

driver=`lpstat -v $PRINTER | sed -e "s/device for $PRINTER: //"`

status=0
if [ "$jobs" = "-" ]; then
  # remove all jobs for the PRINTER 
     jobs=`lpstat $PRINTER | cut -d\  -f1 | sed -e "s/$PRINTER-//"`
fi
for n in $jobs ; do
  # remove separate job by number
    # first remove job from spool queue
    if lprm-cups -P $PRINTER $n ; then
    # then kill driver of active job if is
       pid=`sudo ps --no-headers -C $driver --format pid,command`
       pid=`echo $pid | grep "$driver $n "`
       pid=`echo $pid | awk '{print $3}'`
       if [ -n "$pid" ]; then
          sudo kill -9 $pid
       fi
    else
       # lprm-cups is failed, maybe "not owner". 
       # Bad return status, but continue
       status=`expr $status + 1`
    fi
done
exit $status

  reply	other threads:[~2004-10-21 17:21 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-21  0:01 dm
2004-10-21  3:42 ` Sergey Lizogub
2004-10-21 19:54   ` dm
2004-10-22 11:11     ` Aleksander N. Gorohovski
2004-10-22 12:15       ` Mike Lykov
2004-10-22 11:27         ` Aleksander N. Gorohovski
2004-10-22 13:42           ` Анатолий Китайкин
2004-10-23 13:21             ` Aleksander N. Gorohovski
2004-10-24  8:28               ` Анатолий Китайкин
2004-10-25  8:15                 ` Aleksander N. Gorohovski
2004-10-25 10:14                   ` Анатолий Китайкин
2004-10-25 10:17                   ` Yuri Horoshkov
2004-10-22 13:48           ` Alexej Kryukov
2004-10-23 13:20             ` Aleksander N. Gorohovski
2004-10-21  5:02 ` Yura Kalinichenko
2004-10-21  7:36   ` Ivan Fedorov
2004-10-21  8:23     ` Aleksander N. Gorohovski
2004-10-21  8:25   ` Re[2]: " dm
2004-10-21 17:21     ` Yura Kalinichenko [this message]
2004-10-21 21:38       ` dm
2004-10-22  7:41       ` Re[2]: " Aleksander N. Gorohovski
2004-10-21  5:04 ` Mike Lykov
2004-10-21  8:21   ` [JT] " dm
2004-10-21  8:34     ` Maxim Tyurin
2004-10-21  8:46     ` Mike Lykov
2004-10-21  9:14       ` Re[2]: " dm
2004-10-21  9:26         ` Mike Lykov
2004-10-24 16:18       ` Michael Shigorin
2004-10-24 15:53     ` q: alt webring? (was: [Comm] OpenOffice print troubles) Michael Shigorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1098379289.2871.42.camel@iceb \
    --to=yuk@iceb.vinnitsa.com \
    --cc=community@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git