You are not logged in.

#1 2011-11-01 22:10:12

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Are the cron folders already setup to run?

So, after years of using Linux, I'm ready to setup my first cron job.

After I start the cron daemon ("crond" from "cronie"), are the cron.[daily, hourly, monthly, weekly] folders supposed to run automatically?

It appears that they're not, and that I have to add jobs to the root crontab by using "sudo crontab -e" to run the scripts in each of those directories. I'm very surprised because I can't seem to find any information about it on the Arch Linux wiki cron page. I did find a bit of information on setting it up here, which looks accurate but a bit old.

Thank you.

Offline

#2 2011-11-01 22:22:12

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Are the cron folders already setup to run?

Not sure (I'm not using cronie), but check if https://bbs.archlinux.org/viewtopic.php … 47#p993047 still applies i.e. anacron covers the daily, weekly and monthly jobs.
Why do you think the jobs are not run automatically?

Last edited by karol (2011-11-01 22:23:15)

Offline

#3 2011-11-02 00:49:57

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Are the cron folders already setup to run?

Thank you, that's very good information.

The reason I don't think it's working is because the script I made isn't being run... I made a "pacman-sync.sh" script like so:

#!/usr/bash
pacman -Sy 1>/dev/null 2>&1

It's owned by root with permissions set to 755. I started "/etc/rc.d/crond" manually and can confirm that the "crond" is running. Both "crontab -l" and "sudo crontab -l" have no output.

I assumed that the script would automatically run every hour, just by being in that directory, but it doesn't appear to be. I still have to type the command by hand to sync pacman.

When I started looking into using cron, I found out I had dcron. I read that dcron had been replaced by cronie in the default Arch Linux install, so I switched to that. Even so, I assume that shouldn't make much difference...

Offline

#4 2011-11-02 00:56:55

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Are the cron folders already setup to run?

Wrt running 'pacman -Sy' in a cronjob, please read http://mailman.archlinux.org/pipermail/ … 14645.html
I think the final version of the script is here: http://mailman.archlinux.org/pipermail/ … 14673.html


I'll install cronie and have a look at how it deals with custom cronjobs.



Edit:
'/usr/bash'? Maybe that's your problem?

Last edited by karol (2011-11-02 00:58:01)

Offline

#5 2011-11-02 02:14:25

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Are the cron folders already setup to run?

cron seems to be running OK so I think you need to fix your script and check the log.
I've put

 
#!/bin/bash
touch /home/karol/itsalive

in /etc/crond.hourly and it does run. Same for daily cronjobs.

Offline

#6 2011-11-02 02:26:35

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Are the cron folders already setup to run?

karol wrote:

'/usr/bash'? Maybe that's your problem?

Ooh, I bet that was my problem. Thank you for testing it. I, too, setup a little script to test my installation, and will find out if it works in about an hour. wink

Anyway, thanks to your help, I learned a lot about setting up cron and how it works. When I get the chance, I'll update the (outdated) Arch Linux wiki cron page.

karol wrote:

Wrt running 'pacman -Sy' in a cronjob, please read http://mailman.archlinux.org/pipermail/ … 14645.html
I think the final version of the script is here: http://mailman.archlinux.org/pipermail/ … 14673.html

Holy moley, that is some serious pacman-scripting voodoo. That's beautiful! Thanks to that script, I no longer need to use cron or check for updates as root.

I saved a personal copy of that "checkupdates" script, but may I ask what the official plans are for it? Will it be included in a package?

Offline

#7 2011-11-02 02:34:06

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Are the cron folders already setup to run?

drcouzelis wrote:

I saved a personal copy of that "checkupdates" script, but may I ask what the official plans are for it? Will it be included in a package?

I only know what Kyle posted to the ML: http://mailman.archlinux.org/pipermail/ … 14645.html

keenerd wrote:

I feel it would make a good addition to pacman-contrib.

Whether our devs feel the same - I don't know ;P

Offline

#8 2011-11-02 16:17:51

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Are the cron folders already setup to run?

I wasn't aware of this but it's true (I just checked it), the default setup prevents scripts with dots in the filename from being executed.

Offline

Board footer

Powered by FluxBB