Unix Technical Forum

Question about cron.daily/hourly and son.

This is a discussion on Question about cron.daily/hourly and son. within the Slackware Linux Support forums, part of the Unix Operating Systems category; --> I got a small question about cron jobs. I put a small script in /etc/cron.daily, makes it executable, it ...


Go Back   Unix Technical Forum > Unix Operating Systems > Slackware Linux Support

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-19-2008, 03:51 PM
micke
 
Posts: n/a
Default Question about cron.daily/hourly and son.

I got a small question about cron jobs.
I put a small script in /etc/cron.daily, makes it executable, it runs
everyday at 0702 just as it should. After reading and looking around I see
that this is not the way to do it? I've done it this way for several years
and it has always worked. Am I totally wrong on this? Do I really have to
use crontab for everything?

Micke
--
# The truth lies in there, #
# somewhere in the manual. #
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-19-2008, 03:51 PM
Floyd L. Davidson
 
Posts: n/a
Default Re: Question about cron.daily/hourly and son.

micke <micke_spam_@_remove_gullarp_this_to.com> wrote:
>I got a small question about cron jobs.
>I put a small script in /etc/cron.daily, makes it executable, it runs
>everyday at 0702 just as it should. After reading and looking around I see
>that this is not the way to do it? I've done it this way for several years
>and it has always worked. Am I totally wrong on this? Do I really have to
>use crontab for everything?
>
>Micke


Yes, you must use crontab for everything... and indeed, you *are*!

Just indirectly, that's all. And that is fine. Your crontab executes
/etc/cron.daily at 0702 every day, and anything you want to have done
at that time, in that sequence, can just be added to the cron.daily
script.

For example, if you want something run once a week, you /could/
put it in cron.daily and code it to only run on Mondays. It
would seem to be much better to put that directly into crontab
though, eh?

--
FloydL. Davidson <http://web.newsguy.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@barrow.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-19-2008, 03:51 PM
micke
 
Posts: n/a
Default Re: Question about cron.daily/hourly and son.

Floyd L. Davidson wrote:


> Yes, you must use crontab for everything... and indeed, you *are*!
>
> Just indirectly, that's all. And that is fine. Your crontab executes
> /etc/cron.daily at 0702 every day, and anything you want to have done
> at that time, in that sequence, can just be added to the cron.daily
> script.
>
> For example, if you want something run once a week, you /could/
> put it in cron.daily and code it to only run on Mondays. It
> would seem to be much better to put that directly into crontab
> though, eh?
>


If I would need something done specific days in the week or month then it's
natural to use crontab, yes I agree and yes crontab is involved all the
time as you say inderectly. Thank you for your reply, I was getting a bit
confused since I do my backup on the server every morning at 0702 and that
seems to be working for a few years without problem, and then all the
sudden I hear, no rather read, that it has to be setup with crontab to work
and not only put in to /etc/cron.daily. But I continue my way even after
upgrading to 10.0 on my server I'll see if continue working.

Thanks a lot!
Micke
--
# The truth lies in there, #
# somewhere in the manual. #
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-19-2008, 03:51 PM
william.hamblen@earthlink.net
 
Posts: n/a
Default Re: Question about cron.daily/hourly and son.

On 2004-09-25, micke <micke_spam_@_remove_gullarp_this_to.com> wrote:

> I got a small question about cron jobs.
> I put a small script in /etc/cron.daily, makes it executable, it runs
> everyday at 0702 just as it should. After reading and looking around I see
> that this is not the way to do it? I've done it this way for several years
> and it has always worked. Am I totally wrong on this? Do I really have to
> use crontab for everything?


No, you don't need to crontab for everything. You just use crontab
for those cases where you want to do something differently.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 02-19-2008, 03:51 PM
Rich Grise
 
Posts: n/a
Default Re: Question about cron.daily/hourly and son.

On Saturday 25 September 2004 06:44 am, william.hamblen@earthlink.net did
deign to grace us with the following:

> On 2004-09-25, micke <micke_spam_@_remove_gullarp_this_to.com> wrote:
>
>> I got a small question about cron jobs.
>> I put a small script in /etc/cron.daily, makes it executable, it runs
>> everyday at 0702 just as it should. After reading and looking around I
>> see that this is not the way to do it? I've done it this way for several
>> years and it has always worked. Am I totally wrong on this? Do I really
>> have to use crontab for everything?

>
> No, you don't need to crontab for everything. You just use crontab
> for those cases where you want to do something differently.


Well, I've just read man crontab, and I still have no idea how it works.
It's kinda like reading KA's exposition of memes.

I do have this stuff, which the only person who I can think of who might
have put it there would be Mr Volkerding, by script:
rich@entheos:~
$ ls /etc/cron.daily
logrotate* slocate*
rich@entheos:~
$ ls /etc/cron.hourly
kmod*
rich@entheos:~
$ ls /etc/cron.monthly
rich@entheos:~
$ ls /etc/cron.weekly
rich@entheos:~
$ locate crontab
/usr/doc/ntp-4.2.0/scripts/support/etc/crontab
/usr/man/man1/crontab.1.gz
/usr/X11R6/include/X11/bitmaps/crontab.xbm
/usr/X11R6/include/X11/pixmaps/crontab.xpm
/usr/share/vim/vim63/syntax/crontab.vim
rich@entheos:~
$

So I'd be tempted to just plunk a a script down in one of those $DIRs.
I'm pretty sure I need to learn how to do this for NTP, but I need to read
more about that too.

Cheers!
Rich

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 02-19-2008, 03:51 PM
Joost Kremers
 
Posts: n/a
Default Re: Question about cron.daily/hourly and son.

Rich Grise wrote:
> Well, I've just read man crontab, and I still have no idea how it works.


do as root 'crontab -l' and all will be revealed.

> It's kinda like reading KA's exposition of memes.


who's KA?

> So I'd be tempted to just plunk a a script down in one of those $DIRs.


no offence, but if you intend to do sysadmining, you'd better know how this
stuff works exactly. otherwise, it'll come back and bite you some day.

--
Joost Kremers joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 02-19-2008, 03:52 PM
Rich Grise
 
Posts: n/a
Default Re: Question about cron.daily/hourly and son.

On Saturday 25 September 2004 04:30 pm, Joost Kremers did deign to grace us
with the following:

> Rich Grise wrote:
>> Well, I've just read man crontab, and I still have no idea how it works.

>
> do as root 'crontab -l' and all will be revealed.
>
>> It's kinda like reading KA's exposition of memes.

>
> who's KA?
>
>> So I'd be tempted to just plunk a a script down in one of those $DIRs.

>
> no offence, but if you intend to do sysadmining, you'd better know how
> this stuff works exactly. otherwise, it'll come back and bite you some
> day.
>

No offense taken. :-) Like I said, I'm "tempted," but thankfully I still
have this little bubble of sanity left in my headbone that stops me from
doing really dangerously stupid stuff, mostly. ;-)

Thanks!
Rich

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 02-19-2008, 03:52 PM
micke
 
Posts: n/a
Default Re: Question about cron.daily/hourly and son.

Rich Grise wrote:

>SNIP
>
> So I'd be tempted to just plunk a a script down in one of those $DIRs.
> I'm pretty sure I need to learn how to do this for NTP, but I need to read
> more about that too.
>
> Cheers!
> Rich


Well it's not hard to understand infact as suggested crontab -l gives
information that is very easy to get (even for me), I started this thread
with the simple reason that sonetimes you would like to do things the
simple way (I prefer that) and not put up new cron-jobs on diffrent times
but use what is already done.
Like in the /etc/cron.hourly things are done at one specific time x number
of minutes after full hour. My thoughts was that since I have already set
up the times for those jobs ones and didn't want to do it once again since
the time of day is important. Don't want to disturbe the network with doing
maintenance on working hours but at one time per day before people start
working and use the same time for all those daily jobs (backup, logrotate
and so on). I prefer to put the scripts in the cron.daily and it will be
done at the correct time. Without having to change anything with crontab.
This works in Slack 7 8 9 and 10 I wasn't sure about then thats the reason
for asking BEFORE I upgrade to 10 on the servers.
Thanks all for your replies!

Micke

--
# The truth lies in there, #
# somewhere in the manual. #
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 02-19-2008, 03:55 PM
=?UTF-8?B?0JTQsNC80ZjQsNC9INCT0LXQvtGA0LPQuNC10LLRgdC60Lg=?=
 
Posts: n/a
Default Re: Question about cron.daily/hourly and son.

>>I got a small question about cron jobs.
>>I put a small script in /etc/cron.daily, makes it executable, it runs
>>everyday at 0702 just as it should. After reading and looking around I see
>>that this is not the way to do it? I've done it this way for several years
>>and it has always worked. Am I totally wrong on this? Do I really have to
>>use crontab for everything?


> Yes, you must use crontab for everything... and indeed, you *are*!
>
> Just indirectly, that's all. And that is fine. Your crontab executes
> /etc/cron.daily at 0702 every day, and anything you want to have done
> at that time, in that sequence, can just be added to the cron.daily
> script.
>
> For example, if you want something run once a week, you /could/
> put it in cron.daily and code it to only run on Mondays. It
> would seem to be much better to put that directly into crontab
> though, eh?


What I miss in Slacware is an /etc/crontab file, with the possibility to
specfy as which user the job gets executed. Some other distro's have that
feature.

Like this for ex.:
15 0 * * * root /root/bin/bekap.sh
16 0 * * * apache /var/www/scripts/rebuild.sh


--
дамјан

If Bill Gates had a dime for every time a Windows box crashed...
...Oh, wait a minute, he already does.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 02-19-2008, 03:55 PM
Joost Kremers
 
Posts: n/a
Default Re: Question about cron.daily/hourly and son.

?????? ??????????? wrote:
>>>I got a small question about cron jobs.
>>>I put a small script in /etc/cron.daily, makes it executable, it runs
>>>everyday at 0702 just as it should. After reading and looking around I see
>>>that this is not the way to do it? I've done it this way for several years
>>>and it has always worked. Am I totally wrong on this? Do I really have to
>>>use crontab for everything?

>
>> Yes, you must use crontab for everything... and indeed, you *are*!
>>
>> Just indirectly, that's all. And that is fine. Your crontab executes
>> /etc/cron.daily at 0702 every day, and anything you want to have done
>> at that time, in that sequence, can just be added to the cron.daily
>> script.
>>
>> For example, if you want something run once a week, you /could/
>> put it in cron.daily and code it to only run on Mondays. It
>> would seem to be much better to put that directly into crontab
>> though, eh?

>
> What I miss in Slacware is an /etc/crontab file, with the possibility to
> specfy as which user the job gets executed. Some other distro's have that
> feature.
>
> Like this for ex.:
> 15 0 * * * root /root/bin/bekap.sh
> 16 0 * * * apache /var/www/scripts/rebuild.sh
>
>



--
Joost Kremers joostkremers@yahoo.com
Selbst in die Unterwelt dringt durch Spalten Licht
EN:SiS(9)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 11:04 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com