New in Ubuntu...Need Cron Job help

jrjong

New Member
Credits
14
Hi,

i totally new to Linux and i need help for a Cron Job.
Under windows i had a script that printed a testpage every second Monday at 10AM.

I now want to switch to Linux/Ubuntu but i have no idea how to set up something aol mail like that. I searched a lot but i dont understand what some peoples wrote.
The Script what i found is:

#!/bin/bash
# Drucke Testseite auf dem Standarddrucker - Anzahl der Ausdrucke: -# 1
lpr -# 1 '/home/administrator/Downloads/testbild.pdf'

Can anybody help


I'm using Ubuntu 20
 
Last edited:


khedger

Member
Credits
494
Okay the script you found simply issues the lpr (line print) command to printout the .pdf file that you see specified.
Now what you want to do is schedule a cron job to run this script every second monday at 10 am, right?

You can schedule jobs to be run by cron, using the 'at' command. So, firstly you should do 'man at' and read the documentation for the command.
'at -f "your script name" -t 07131000' would schedule your script to run July 13 (next monday) at 10:00. I don't know of a way to make 'at' do a recurring 'every second ...' type thing, but I'm no expert....hopefully more experienced users here will chime in. What you may have to do is have the script issue the lpr command, do some date logic to figure out tne next date you want to print, then issue an 'at' command to schedule the next run.

Hope this helps,

keith
 


Members online


Top