LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Looking for Cron information. (https://www.linuxquestions.org/questions/linux-newbie-8/looking-for-cron-information-762632/)

Karas 10-17-2009 02:55 PM

Looking for Cron information.
 
Once again, apologies if this is in the wrong thread.

Basically I am a complete n00b at unix, and have very little if no knowledge, however I need to learn about Unix, specifically Slackware.

For the moment I am trying to find as much information as I can about cron, from start to finish.

Can anyone give me information on how to make a cron job run a script every 15 minutes?

From what i've read so far I am gathering that you write the following:-
(pseudo code)

Run every 15 minutes
*script* located at/this/directory/place
DONE

No?

Or do I write the script into a specific file that already says to run whenever.

Thanks in advance LQ community.

catkin 10-17-2009 04:17 PM

There's a lot of good information here. If you get stuck after reading some of those links, please ask again.

acid_kewpie 10-17-2009 04:17 PM

You would really do yourself a favour by search for standard reference documentation about things like this. There is a huge amount of information about cron, and most of it says that it's really basic, as it is. for example http://en.wikipedia.org/wiki/Cron tells you everything you'd ever need to know.

chrism01 10-18-2009 07:52 PM

Other options:

http://www.adminschoice.com/docs/cro...Crontab%20file
http://linux.die.net/man/5/crontab

Karas 10-19-2009 08:57 AM

Is there a way to relate a cron tab to the apache process?

onebuck 10-19-2009 09:03 AM

Hi,

Welcome to LQ & SlackwareŽ!

There's loads of information available but the these specific links will aid you;

SlackwareŽ Essentials
SlackwareŽ Basics
Linux Documentation Project
Rute Tutorial & Exposition
Linux Command Guide
Utimate Linux Newbie Guide
LinuxSelfHelp
Getting Started with Linux
Advanced Bash-Scripting Guide

These links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!

Lordandmaker 10-19-2009 09:08 AM

In what way?

Karas 10-19-2009 09:17 AM

Well I am supposed to be putting together a web server in which people can sign up and create accounts to host websites from, a sort of free web host package system. But at the moment I want apache to have a crontab that runs every few minutes to make new users from a text file. Does it matter what user it's related to? Or can I just make my own user account do the cron? Apologies if I am not making sense.

onebuck 10-19-2009 09:45 AM

Hi,

Quote:

Originally Posted by Lordandmaker (Post 3724882)
In what way?

The way to understanding is getting to know through knowledge shared.

Read!

Lordandmaker 10-19-2009 09:49 AM

Quote:

Originally Posted by Karas (Post 3724896)
Well I am supposed to be putting together a web server in which people can sign up and create accounts to host websites from, a sort of free web host package system. But at the moment I want apache to have a crontab that runs every few minutes to make new users from a text file. Does it matter what user it's related to? Or can I just make my own user account do the cron? Apologies if I am not making sense.

It doesn't matter which user you use, so long as they have the rights to do whatever it is that's involved in creating the users. You want to do a fair bit of sanity checking on the text file, and you _really_ don't want to go for root reading and acting on that text file.

I do it through a setuid'd script.

(onebuck: I was aiming at the post above yours)

Karas 10-19-2009 09:59 AM

Right, so I can have my own user account do the cron script. Cool.

Any by setuid'd you mean?

I've only just about worked out how to view the crontab, now Im working on making it do something as a test! Not getting far!

Edit: Ok i've managed work out to how to create a cron file for my user, however it doesn't appear to work. Most likely my syntax, could I have some suggestions as to what is wrong the following.

Quote:

5 * * * * cat > /home/gary/test.txt more lines to be added
That is supposed to put the text "more lines to be added" into the text.txt file, which is stored in my home directory every five minutes. However it's not.

chrism01 10-19-2009 06:47 PM

1. cron has a minimal env, so always use complete absolute paths to all cmds/files referenced.
2. You cat the contents of a file, you 'echo' strings, so your cmd would normally be more like

echo "some string here" >> /home/you/file.txt

However, you wouldn't put that in a crontab. The best thing to do is write a shell script and call that from cron.


All times are GMT -5. The time now is 08:44 PM.