8 replies [Last post]
co2
co2's picture
Offline
Leader
UK
Last seen: 12 years 24 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

I need to set-up a cron job via the usual crontab on a Linux server. However, I'd like to set the job to activate once per month, and on the first Monday of each month.

Anyone know what I have to specify in the schedule parameters to achieve this? Is it possible?

Smile

The next sentence is true. The previous sentence is false. Discuss...

Tags:
roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 7 years 9 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

Cron help needed

I'm certainly no expert but thinking laterally, how about this:

15 1 1-6 * 1 /script

...which would be 1.15am on every Monday that falls between the first and sixth day of the month. Don't take my word for it though; get an expert to confirm that it's okay Wink

Life's a b*tch and then you die!

co2
co2's picture
Offline
Leader
UK
Last seen: 12 years 24 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

Cron help needed

That seems nice n' logical. I'll give it a whirl to see if it works. Cheers Roy.

Smile

The next sentence is true. The previous sentence is false. Discuss...

roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 7 years 9 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

Cron help needed

co2 wrote:
I'll give it a whirl to see if it works.

...on your head be it Laughing out loud

Life's a b*tch and then you die!

wrender
Offline
newbie
Ottawa
Last seen: 15 years 45 weeks ago
Ottawa
Joined: 2004-11-17
Posts: 4
Points: 0

webmin

I use a program called webmin, it allows you to log in to your server with a web interface, and create cron jobs.

I'm not sure of the specific cron syntax for command line, but you can just type. "man cron" to get the manual for how to use it.

Wes

dJomp
dJomp's picture
Offline
Enthusiast
Last seen: 4 years 34 weeks ago
Joined: 2003-03-23
Posts: 422
Points: 0

Cron help needed

roytheboy wrote:
...which would be 1.15am on every Monday that falls between the first and sixth day of the month. Don't take my word for it though; get an expert to confirm that it's okay Wink

But you're stuffed if the first day of the month is a Tuesday Tongue

You know you're a geek when you try to shoo a fly away from the monitor with your cursor.

co2
co2's picture
Offline
Leader
UK
Last seen: 12 years 24 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

Cron help needed

Yeh, figured that one out! Laughing out loud

Got distracted anyway, and it transpires that it can be resolved another way, a lot easier. Cheers anyway fellas.

And yes, Webmin is essential. Prefer to do most stuff in the command line, to keep me sharp, but Webmin's great for routine stuff.

Smile

The next sentence is true. The previous sentence is false. Discuss...

roytheboy
roytheboy's picture
Offline
Guru
North Wales, UK
Last seen: 7 years 9 weeks ago
North Wales, UK
Timezone: GMT+1
Joined: 2004-09-18
Posts: 2233
Points: 41

Cron help needed

dJomp wrote:
But you're stuffed if the first day of the month is a Tuesday Tongue

Okay, okay :roll: Laughing out loud ...so try: 15 1 1-7 * 1 /script. It was late; I was tired Wink

Webmin is great when you first try to get to grips with running a server, but I am assured by experts in their field that it is inherently insecure due to the way that it mis-uses super-user privileges. Also, it is hardly the most intuitive piece of interface software going as it assumes that the user knows what they are doing (in which case they would probably do everything via the CLI anyway). Personally, I found it more difficult to use that just learning to do everything via the shell and keeping a few notes about where everything is located within the document tree.

Life's a b*tch and then you die!

co2
co2's picture
Offline
Leader
UK
Last seen: 12 years 24 weeks ago
UK
Joined: 2003-09-17
Posts: 721
Points: 0

Cron help needed

Thanks Roy, will give it a go. Smile

The next sentence is true. The previous sentence is false. Discuss...