Sponsored Content
Top Forums Shell Programming and Scripting Avoid interaction into script Post 302462821 by lyapma on Friday 15th of October 2010 06:15:12 AM
Old 10-15-2010
[Solved] Avoid interaction into script

Sorry for my english!

I'm using Debian squeeze and for an assignement, i have create 2 virtual pdf cups printers. Both are working very well.
To test the different administion command; i try to disable one of the printer and move his queue file to the second one. I'm able to do it easily.

Now, i wish to write a bash script that wil test the status of the printer. So that,if the printer is disable, it just execute the "move" script.
Is there a way to know the status of a cups printer and use that information in a script?

For example, a command/function that can return "O" is the cups printer is enable and "1" if not.


I also try using "/usr/sbin/lpc" and after it "status PrinterName". How can be my script so that: after execution "/usr/sbin/lpc" it just execute the command "status" with the first paramater "$1".

Thanks for your help,
 

10 More Discussions You Might Find Interesting

1. HP-UX

Boot interaction

Hi All, I am the new boy on the Block with HP-UX. To get to the point, I have a Hp-ux (C200) workstation running on Hp-ux 11.x Operating System. A week ago when practicing on file access permission, I have set the permission on a directory (perhaps a file I am not sure) to 0544 and did... (19 Replies)
Discussion started by: mhossien
19 Replies

2. Shell Programming and Scripting

avoid displaying errors while executing a script

Hi all, I am running a script on bash shell, although it gives me the desired output, it displays some errors at the prompt like this directory doesnt exists unary operator etc etc Is there someway to avoid these errors ?? Its very annoying to have these errors while the script is... (4 Replies)
Discussion started by: vikas027
4 Replies

3. Programming

Needed help in a ruby script with user interaction involved!

Hi all, I am struck at this point and needed some help in ruby I wanted to write a script that accepts the no of VNICs the user wants to create and then ask for the name of each Vnic he wants then use these names to create the corresponding Vnics Eg: suppose that there are 2 Vnics to be... (0 Replies)
Discussion started by: wrapster
0 Replies

4. Shell Programming and Scripting

Error with script interaction

Hi I have a script which is coming up with errors when I iterate over a list of database names. When I print out the values it shows a title & underline...if I then attach "hi" to the print out I get : hi TBS_SVC_NAME hi ------------------------------ hi bkahepa hi hi echo "select... (14 Replies)
Discussion started by: Dird
14 Replies

5. Shell Programming and Scripting

Avoid file creation in a script...achive same result

Guys following lines help me in getting numbers from PID column ,to be thrown into first column of a CSV file. COLUMNS=2047 /usr/bin/ps -eo pid,ppid,uid,user,args | grep -v "PID" > /tmp/masterPID.txt cat /tmp/masterPID.txt|while read line do PID=`echo $line|awk '{print $1}'` echo "$PID"... (4 Replies)
Discussion started by: ak835
4 Replies

6. Shell Programming and Scripting

using SSH with my script and avoid logging in manually

Hi Guys. I have 3 variables $HOST $Username $Password I want to connect to a remote server using SFTP. usr/bin/sftp -o Cipher=blowfish $HostWhere do I put in the options for the username and pwd??? I have tried different ways and nothing works. It keeps coming back and promting me. ... (5 Replies)
Discussion started by: ramangill
5 Replies

7. Shell Programming and Scripting

Avoid script running multiple times by filelock

Sometimes we need a single instance of a script to run at a time. Meaning, the script itself should detects whether any instances of himself are still running and act accordingly. When multiple instances of one script running, it’s easy to cause problems. I’ve ever seen that about 350 instances... (4 Replies)
Discussion started by: edenCC
4 Replies

8. Shell Programming and Scripting

how do i avoid system hang due to ssh in script?

I have a script that collects data from about 200 servers using 'ssh'. The problem is that, process sometime hangs at some point stopping the execution of the script. Please give me some idea how can I force the execution to jump to the next step if there arises any problem !! Thanks for replies if... (1 Reply)
Discussion started by: mdangol
1 Replies

9. Shell Programming and Scripting

How to avoid locks while loading database through UNIX script.?

Hi, I have the following requirement: I have load_cdr as main scriptwhich loads all the file records into vertica database through unix script. But there are two files which try to update same table..n thats y my script is getting failed... Can any1 give me some logic how to over come this... (6 Replies)
Discussion started by: gnnsprapa
6 Replies

10. UNIX for Beginners Questions & Answers

How to avoid banner o/p in script.?

hi I am writing a script where I don't want to display banner on terminal. below is the script. what should I do to avoid this without doing any permanent changes. I just don't want to avoid printing banner in my script. for i in `cat IP` do ssh root@$i '... (4 Replies)
Discussion started by: scriptor
4 Replies
cupsfilter(8)							    Apple Inc.							     cupsfilter(8)

NAME
cupsfilter - convert a file to another format using cups filters SYNOPSIS
cupsfilter [ --list-filters ] [ -D ] [ -U user ] [ -c config-file ] [ -d printer ] [ -e ] [ -i mime/type ] [ -j job-id[,N] ] [ -m mime/type ] [ -n copies ] [ -o name=value ] [ -p filename.ppd ] [ -t title ] [ -u ] filename DESCRIPTION
cupsfilter is a front-end to the CUPS filter subsystem which allows you to convert a file to a specific format, just as if you had printed the file through CUPS. By default, cupsfilter generates a PDF file. The converted file is sent to the standard output. OPTIONS
--list-filters Do not actually run the filters, just print the filters used to stdout. -D Delete the input file after conversion. -U user Specifies the username passed to the filters. The default is the name of the current user. -c config-file Uses the named cups-files.conf configuration file. -d printer Uses information from the named printer. -e Use every filter from the PPD file. -i mime/type Specifies the source file type. The default file type is guessed using the filename and contents of the file. -j job-id[,N] Converts document N from the specified job. If N is omitted, document 1 is converted. -m mime/type Specifies the destination file type. The default file type is application/pdf. Use printer/foo to convert to the printer format defined by the filters in the PPD file. -n copies Specifies the number of copies to generate. -o name=value Specifies options to pass to the CUPS filters. -p filename.ppd Specifies the PPD file to use. -t title Specifies the document title. -u Delete the PPD file after conversion. EXIT STATUS
cupsfilter returns a non-zero exit status on any error. ENVIRONMENT
All of the standard cups(1) environment variables affect the operation of cupsfilter. FILES
/etc/cups/cups-files.conf /etc/cups/*.convs /etc/cups/*.types /usr/share/cups/mime/*.convs /usr/share/cups/mime/*.types NOTES
Unlike when printing, filters run using the cupsfilter command use the current user and security session. This may result in different out- put or unexpected behavior. EXAMPLE
The following command will generate a PDF preview of job 42 for a printer named "myprinter" and save it to a file named "preview.pdf": cupsfilter -m application/pdf -d myprinter -j 42 >preview.pdf SEE ALSO
cups(1), cupsd.conf(5), filter(7), mime.convs(7), mime.types(7), CUPS Online Help (http://localhost:631/help) COPYRIGHT
Copyright (C) 2007-2017 by Apple Inc. 11 June 2014 CUPS cupsfilter(8)
All times are GMT -4. The time now is 08:20 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy