Shell script to remove print jobs older than xx days
Am looking for a shell script that will allow me to remove old print jobs that are in the cups print queue, preferably based on days old, like 5 days or older print jobs will be removed. Do not want a complicated perl script, just as simple as possible shell script, i do not know how to script at all at this point.
Thanks |
do the lpq / lprm and like commands do anything for you ?
|
if there is a command syntax to remove based on days old that would be fine also, do not want to have to keep manually removing them by job or print queue all of the time, want to be able to enter one command and have all print jobs older than xx days removed. Thanks..
|
Most Linux distros come with print managers that allow you to specify deleting the file after it is printed. Since you don't wish to learn shell scripting at this point, perhaps you should investigate what your distro provided.
Also, reading tutorials->linuxquestions.org->how-to-ask-a-question might be of help. |
Spect73, if you do not want to help, please do not waste my time with your useles and helpless suggestions. No Thanks
|
I just signed up as a member today, the ? that I asked is one that millions should ask, I have searched the web and have not found any of the example shell scripts to work, this should be something simple and easy to do in a robust OS as Linux, but I have looked and either have overlooked it or it is not there. I can not believe that someone else has not wanted this and I do not believe in recreating the wheel. Thanks
|
i dont have a printer simply because they are a waste of paper and ink. if i were to buy a printer then i would probably create a bash 1-liner using lpq and save the output to a log. then every 3 days cron would read the log and lprm all the print jobs on the log. (maybe even print a page repeating the line "all done <@:)" just for the shiggles).
|
schneidz, thank you for your response, but we have 100's of printers on our linux server, i really just want a simple script that i can run whenever i want to run it or a command line command that allows me to put in xx days and back to remove print jobs for, we have a lot of people who if a printer does not print,they keep trying and trying and those print jobs get stuck in the queue and never clear, is there some setting in cups that would remove old print jobs based on days? Thanks again.
|
Quote:
http://www.mnxsolutions.com/linux/cu...lder-than.html ...is a fully-functional Python script to do just that. Quote:
I'll agree with Spect73...if you don't want to learn how to write your own bash scripts, you'll have to use the tools that are available to you with your distro. There are many easily-found bash scripting tutorials...combine them with the man pages on lpq/lpqrm, and you have the tools necessary for you to do this yourself, rather than complaining that others haven't just done it for you. |
TBOne, thanks for nothing, no thanks
|
Quote:
Otherwise, show some effort of your own...and given your fairly rude attitude towards folks who have tried to help you, and the laziness you've displayed by not even TRYING to do it yourself, don't be surprised when people don't fall over themselves to write programs for you...for free. |
TBOne, I am extremely sorry, I was so frustrated and in a hurry yesterday that I missed the link that you had included in your reponse. I had spent over 4 hours trying to figure something out before I finally gave up and signed up on this forumn, I suffer from an Anxiety Disorder and when I get frustrated, it snowballs down hill on me, I was at the point that I just needed a solution that would work, as I stated orginally that I do not know script coding at all. Please forgive me for my rudeness yesterday, I have had time to calm down. Thanks very much for your patience, I will try the script that you suggested and see how it works. Take Care.
|
Quote:
The Linux Documentation Project (TLDP) is a great resource: http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html http://www.tldp.org/LDP/Bash-Beginne...ers-Guide.html http://www.tldp.org/LDP/abs/html/ ...which takes you from the VERY beginning to pretty advanced concepts, complete with examples and sample source code. Good luck to you. |
TBOne, the python script from the link you gave me works perfectly for what I need, it works great from the command line, some people said they could not get it to work thru cron, but I am not planning on running it thru cron at this time. Thanks for your help and for the suggestion to learn more about scripting, thanks for the links to that also. Take Care.
|
All times are GMT -5. The time now is 03:02 PM. |