1 |
Mark Knecht skrev: |
2 |
> Hello, |
3 |
> Thanks to those that helped me with the new printer thread the |
4 |
> other day. We purchased an HP M1522nf from NewEgg. It arrived in under |
5 |
> 24 hours and tool me less than 2 minutes to get a test page. Quite a |
6 |
> success. Thanks! |
7 |
> |
8 |
> I'd now like to set up a cron job to print a small file each |
9 |
> evening just to keep the printers rollers moving every day. I've never |
10 |
> used cron before. It looks *fairly* straight forward but I'd like to |
11 |
> get some verification if I might. Thanks again. |
12 |
> |
13 |
> 1) In /root I created a small executable file that store df -h to a |
14 |
> file and then I print that file using lpr. I executed that file using |
15 |
> lpr -D HP_M1522nf print_todays_info and it appears to have worked. |
16 |
> (I'm remote but I do see a print job in the CUPS records. I'll call |
17 |
> later to see if it's printing correctly but I suspect it is.) |
18 |
> |
19 |
> 2) As root I ran crontab -e. The editor (nano) came up fine. |
20 |
> |
21 |
> 3) I entered the following line for testing |
22 |
> |
23 |
> 5 * * * * /root/print_todays_info |
24 |
> |
25 |
> If I'm correct then I understand that this would run the job every |
26 |
> hour 5 minutes after the hour. I'll change it to |
27 |
> |
28 |
> 5 1 * * * /root/print_todays_info |
29 |
> |
30 |
> after I've tested it a bit more to make it a 1:05AM print job. |
31 |
> |
32 |
> Looking in the CUPS logs on the remote machine it appears a new copy |
33 |
> printed a 5 minutes after 9AM so I'm thinking it's set up. |
34 |
> |
35 |
> Does this sound about right? Anything else I should be doing? |
36 |
> |
37 |
> Thanks, |
38 |
> Mark |
39 |
> |
40 |
> |
41 |
|
42 |
The cronjob is right. You can also put your script under /etc/cron.daily |
43 |
and you won't have to edit the crontab manually. I also prefer to make |
44 |
sure that local mail delivery is working so cron may mail the results |
45 |
somewhere. |
46 |
|
47 |
-- |
48 |
|
49 |
|
50 |
//*David Sveningsson [eXt]* |
51 |
|
52 |
Freelance coder | Game Development Student |
53 |
http://sidvind.com |
54 |
|
55 |
Thou shalt make thy program's purpose and structure clear to thy fellow |
56 |
man by using the One True Brace Style, even if thou likest it not, for |
57 |
thy creativity is better used in solving problems than in creating |
58 |
beautiful new impediments to understanding. |