LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-17-2009, 02:55 PM   #1
Karas
Member
 
Registered: Oct 2009
Distribution: Slackware 13.0
Posts: 49

Rep: Reputation: 15
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.
 
Old 10-17-2009, 04:17 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
There's a lot of good information here. If you get stuck after reading some of those links, please ask again.
 
Old 10-17-2009, 04:17 PM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
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.
 
Old 10-18-2009, 07:52 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Other options:

http://www.adminschoice.com/docs/cro...Crontab%20file
http://linux.die.net/man/5/crontab
 
Old 10-19-2009, 08:57 AM   #5
Karas
Member
 
Registered: Oct 2009
Distribution: Slackware 13.0
Posts: 49

Original Poster
Rep: Reputation: 15
Is there a way to relate a cron tab to the apache process?
 
Old 10-19-2009, 09:03 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
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!
 
Old 10-19-2009, 09:08 AM   #7
Lordandmaker
Member
 
Registered: Sep 2005
Location: London, UK
Distribution: Debian
Posts: 258

Rep: Reputation: 39
In what way?
 
Old 10-19-2009, 09:17 AM   #8
Karas
Member
 
Registered: Oct 2009
Distribution: Slackware 13.0
Posts: 49

Original Poster
Rep: Reputation: 15
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.
 
Old 10-19-2009, 09:45 AM   #9
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
Hi,

Quote:
Originally Posted by Lordandmaker View Post
In what way?
The way to understanding is getting to know through knowledge shared.

Read!
 
Old 10-19-2009, 09:49 AM   #10
Lordandmaker
Member
 
Registered: Sep 2005
Location: London, UK
Distribution: Debian
Posts: 258

Rep: Reputation: 39
Quote:
Originally Posted by Karas View Post
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)

Last edited by Lordandmaker; 10-19-2009 at 09:51 AM.
 
Old 10-19-2009, 09:59 AM   #11
Karas
Member
 
Registered: Oct 2009
Distribution: Slackware 13.0
Posts: 49

Original Poster
Rep: Reputation: 15
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.

Last edited by Karas; 10-19-2009 at 10:33 AM.
 
Old 10-19-2009, 06:47 PM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cron.hourly cron.weekly cron.monthly and 0anacron. Are they necessary? glore2002 Debian 2 09-30-2009 08:57 PM
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 01:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 01:50 PM
Information on Cron jmarsh Linux - Networking 1 02-14-2003 09:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration