LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 07-08-2013, 07:59 AM   #1
kikinovak
Senior Member
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: Slackware, Slackware64
Posts: 1,489

Rep: Reputation: 662Reputation: 662Reputation: 662Reputation: 662Reputation: 662Reputation: 662
Slackware and cronjobs


Hi,

I wonder what's the orthodox way to handle cronjobs on a Slackware machine. Say I have to run a weekly backup script. I'd edit crontab using crontab -e like this, for example:

Code:
15 3 * * 0 root /root/backup.sh
So the script would run every Sunday at 3:15 AM.

Now in Slackware, there's a series of cron.daily, cron.weekly etc. directories, containing each a series of scripts, to be run at respective intervals.

I wonder if an orthodox way of running my script would be to move and rename it to, say, /etc/cron.weekly/backup... and then leave it there.

I'd be grateful for the relevant piece of information/documentation about the subject.

Cheers,

Niki
 
Old 07-08-2013, 08:08 AM   #2
Mark Pettit
Member
 
Registered: Dec 2008
Location: Cape Town, South Africa
Distribution: Slackware 14.1 64 Multi-Lib
Posts: 420

Rep: Reputation: 123Reputation: 123
I think the /etc/cron.* directories are merely conveniences. They make configuration somewhat simpler, but at the cost of fine-granular control. Also, they are not available to non-root users.
 
1 members found this post helpful.
Old 07-08-2013, 08:36 AM   #3
jostber
Member
 
Registered: Jul 2001
Location: Skien, Norway
Distribution: Slackware 14.0 64-bit
Posts: 228

Rep: Reputation: 41
Interesting article on dcron in Slackware here:

http://www.nickcoleman.org/blog/inde...112181115!unix
 
1 members found this post helpful.
Old 07-08-2013, 08:36 AM   #4
kikinovak
Senior Member
 
Registered: Jun 2011
Location: Montpezat (South France)
Distribution: Slackware, Slackware64
Posts: 1,489

Original Poster
Rep: Reputation: 662Reputation: 662Reputation: 662Reputation: 662Reputation: 662Reputation: 662
OK, thanks very much.
 
Old 07-08-2013, 08:52 AM   #5
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,436
Blog Entries: 11

Rep: Reputation: 181Reputation: 181
cron.* is called by /etc/crontab which gets sourced by crond. The only downside I can see using them is that they are run at a fixed time and in sequencial order. So if your first job in cron.daily takes two hours all the other jobs need to wait. Good or bad. But I don't want my cronjobs to hog the system. I would use the cron.* directories for system specific jobs like backup (your use case) or update checking or removing stuff, logrotation etc. And user owned jobs (crontab -e) for special needs like cleaning after my auto compilation or similar.
 
1 members found this post helpful.
Old 07-08-2013, 02:35 PM   #6
Diantre
Member
 
Registered: Jun 2011
Distribution: Slackware
Posts: 389

Rep: Reputation: 148Reputation: 148
The default root crontab (/var/spool/cron/crontabs/root) uses /usr/bin/run-parts to execute scripts in the /etc/cron.* directories.

Code:
bash-4.2# crontab -l
# If you don't want the output of a cron job mailed to you, you have to direct
# any output to /dev/null.  We'll do this here since these jobs should run
# properly on a newly installed system.  If a script fails, run-parts will
# mail a notice to root.
#
# Run the hourly, daily, weekly, and monthly cron jobs.
# Jobs that need different timing may be entered into the crontab as before,
# but most really don't need greater granularity than this.  If the exact
# times of the hourly, daily, weekly, and monthly cron jobs do not suit your
# needs, feel free to adjust them.
#
# Run hourly cron jobs at 47 minutes after the hour:
47 * * * * /usr/bin/run-parts /etc/cron.hourly 1> /dev/null
#
# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null
#
# Run weekly cron jobs at 17:30 on the first day of the week:
30 17 * * 0 /usr/bin/run-parts /etc/cron.weekly 1> /dev/null
#
# Run monthly cron jobs at 4:20 on the first day of the month:
20 4 1 * * /usr/bin/run-parts /etc/cron.monthly 1> /dev/null
Usually I change the times in the default crontab and put my backup scripts in /etc/cron.weekly. Works for me.
 
1 members found this post helpful.
  


Reply

Tags
cronjob


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to verify Cronjobs smilemukul Linux - Newbie 1 03-10-2011 02:57 PM
[SOLVED] cronjobs in ubuntu dinakumar12 Linux - Server 7 04-02-2010 05:31 AM
CronJobs error archey Linux - Newbie 4 08-22-2009 05:16 PM
Cronjobs problem segasieu Linux - Server 2 05-01-2008 10:10 PM
outdated cronjobs bujecas Linux - Software 6 08-04-2005 10:24 AM


All times are GMT -5. The time now is 07:32 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration