Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
The problem, well I don't do much printing. I have both a laser printer and an inkjet, the laser isn't a problem - dry toner etc, but the inkjet suffers from dried out cartridges/blocked and/or unblockable jets.
I've looked into things a little, and it would appear that I should configure/install/setup (whatever) cron to print off a test page once a week or so.
I appear to have it installed, but I don't even know where to start with configuration. I suffer from personal stupidity when it comes to decyphering Linux docs. I've found that even so called "newb documentation" means the square root of f*** all to me.
does anyone know of a stage by stage howto, that will explain how I configure cron (or vixie cron or kcron or Anacron etc etc) ? (preferably written in english, not technoblurb).
Thanks for the links win32sux, but I'm still flummoxed. The first two, mention a file called /etc/crontab - my system says "file /etc/crontab does not exist". Sure, I can find directories in /etc/ called cron.daily, cron.hourly, etc etc, but nothing (directory or file) that says "crontab". I also don't have much of a clue as to how I'd work out what I'd need to put in to a command to make my inkjet printer start (irrespective of how often) and print a test page (even a cups test page would do).
Maybe there's a cron type app that has a graphic frontend so I can just set it up that way, but I doubt it or I'm convinced that I'd have seen mention of it! The only thing that I've found thus far, is kcron, but that's only got a very vague KDE type dialogue box, and if I look at the kcron help, it just goes off about variables and other stuff that I have absolutely no knowledge of !
on my home pc (slackware) the crontabs are in /var/spool/cron/crontabs/
to edit a crontab i use the command "crontab -e"... if i execute that command as root, then i am editing root's crontab... if i execute the command as win32sux, then i am editing win32sux's crontab... currently i haven't cronned anything here at home, so my win32sux crontab is empty, and my root crontab has the default slackware stuff which calls those cron.daily, cron.hourly, cron.monthly, and cron.weekly directories you've already seen...
my root crontab looks like this:
Code:
# If you don't want the output of a cron job mailed to you, you have to direct
# any output to /dev/null. We'll do this here since these jobs should run
# properly on a newly installed system, but if they don't the average newbie
# might get quite perplexed about getting strange mail every 5 minutes. :^)
#
# Run the hourly, daily, weekly, and monthly cron jobs.
# Jobs that need different timing may be entered into the crontab as before,
# but most really don't need greater granularity than this. If the exact
# times of the hourly, daily, weekly, and monthly cron jobs do not suit your
# needs, feel free to adjust them.
#
# Run hourly cron jobs at 47 minutes after the hour:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
#
# Run weekly cron jobs at 4:30 on the first day of the week:
30 4 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
if i wanted to add a cron task that would (for example) delete a certain directory every sunday morning at 7:05am, i would add a line that looks like this:
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700
Rep:
This is what I would do.
Type ' lpstat -p ' to list printer names. Example of mine.
Code:
[crusher58@lcomp58 data]$ lpstat -p
printer OfficeJet is idle. enabled since Jan 01 00:00
printer PhotoSmart is idle. enabled since Jan 01 00:00
Print file sent, waiting for printer to finish...
Now I type the command ' /usr/bin/lpr -P PhotoSmart /usr/share/cups/data/testprint.ps '. This prints the file testprint.ps to my PhotoSmart printer.
Next to run it in cron. If you have a directory called /etc/cron.weekly then create a script like this.
Contents of the script called ' refresh_carditages ' and put it in /etc/cron.weekly. Final /etc/cron.weekly/refresh_carditages
Code:
#!/bin/bash
# command prints the test page to my PhotoSmart Printer
/usr/bin/lpr -P PhotoSmart /usr/share/cups/data/testprint.ps
Then make it executable by typing ' chmod +x /etc/cron.weekly/refresh_carditages
If not there do a ' whereis cron.weekly ' or ' whereis cron '.
BTW, if you don't wanna muck with the crontab yet and just want to get your thing printed weekly with minimum fuss then just create a shell script that prints your thing (make sure you test it) and then put it in the /etc/cron.weekly/ directory... it will automatically get executed by cron on a weekly basis... for example: take a look at my crontab above, if i was to drop a script into the /etc/cron.weekly directory it would get executed at 4:30am on sundays - without me having to do anything besides place the script in the directory...
of course you need to make sure you are running cron for it to work:
Code:
ps aux | grep crond
EDIT: well, seems like Brian1 beat me to the cron.weekly suggestion... hehe...
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700
Rep:
Its nice when great minds think alike there win32sux. Nothing beats the simplicity of scripts.
Just had a thoght here. Not sure if the testprint uses both color and black cartiages to do this. Mostly wanted to print a color image to keep the color going. I think if you print a text file it uses the black cartiage then. Not sure though. Might need to add a line to print a small text file to printer to make sure you get the black one as well.
i just did the Brian1-style test page print like so:
Code:
bash-3.00$ lpstat -p
printer epy is idle. enabled since Jan 01 00:00
bash-3.00$ lpr -P epy /usr/share/cups/data/testprint.ps
it successfully printed the test page in black and white mode, which is what i have configured in the default options section of the cups thing on http://localhost:631 (i have an HP Deskjet 3420 Color/BW)...
so yeah, like Brian1 said: i could make a simple shell script now:
Distribution: Distribution: RHEL 5 with Pieces of this and that.
Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700
Rep:
Well still giving this a thought. I believe if one passes the -o option. My default is color so I think it did not use the black to print. Could be wrong here.
If anyone has an idea on how to print in grayscale when default printer setting is set for color please pass them along. Thanks for your time and help.
Not having any luck printing in grayscale yet. Options tried.
/usr/bin/lpr -P PhotoSmart -o Resolution=300DraftGrayscaleCMYK /usr/share/cups/data/testprint.ps
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.