LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 03-05-2009, 06:23 AM   #1
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,350

Rep: Reputation: 75
Default slackware root crontab


I have just read in slackware-basics that there is a default slackware root crontab which runs scripts in various /etc/cron directories.

Not being aware of this, I have over-written the default crontab to run my own rsync script. Presumably I have lost what might be some useful functions in the default crontab.

How can I restore the default crontab?

Thanks
 
Old 03-05-2009, 06:33 AM   #2
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware64-15.0
Posts: 6,367

Rep: Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747Reputation: 2747
Reinstall the dcron package.
 
Old 03-05-2009, 06:34 AM   #3
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
Login as root and do "crontab -e" and paste this in

Code:
# 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, but if they don't the average newbie
# might get quite perplexed about getting strange mail every 5 minutes. :^)
#
# 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 4:30 on the first day of the week:
30 4 * * 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
 
Old 03-05-2009, 06:37 AM   #4
Noryungi
Member
 
Registered: Jul 2003
Location: --> X <-- You are here.
Distribution: Slackware, OpenBSD
Posts: 305

Rep: Reputation: 53
Mount your Slackware installation CD, and re-install the package named: "dcron-2.3.3-i486-6.tgz" (in the "/a" directory) this should reinstall the default crontab as well.

If you don't want to reinstall the whole package, just do a "tar xvzf dcron-2.3.3-i486-6.tgz" in a directory (for instance in /root) and look for the correct crontab file. I can't remember if this is a separate file in the package or if this is generated by the installation procedure for the package.

Hope this helps!
 
Old 03-05-2009, 06:45 AM   #5
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,894

Rep: Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014Reputation: 5014
One of the first changes I like to make to my system is to nice them
Code:
/usr/bin/nice -n 19 /usr/bin/run-parts /etc/cron.daily
Seems to help keep the system a little more responsive if you happen to be using it when they kick in.

Probably not a big issue if you have a strong multi-core machine, but it makes a hell of a difference on my P3-800.
 
Old 03-05-2009, 01:48 PM   #6
arubin
Senior Member
 
Registered: Mar 2004
Location: Middx UK
Distribution: Slackware64 15.0 (multilib)
Posts: 1,350

Original Poster
Rep: Reputation: 75
Thanks all.

What I did was got hold of the package and ran explodepkg which showed that the file I wanted was called root.new.

I then ran crontab root.new

Examining the package install script showed that allend and Noryungi's suggestion would not have had the desired effect


Code:
root@LavanKossot:/home/alan/packages/temp/install# cat doinst.sh
if [ ! -r var/spool/cron/crontabs/root ]; then
  mv var/spool/cron/crontabs/root.new var/spool/cron/crontabs/root
else
  mv var/spool/cron/crontabs/root.new var/spool/cron/root.crontab.sample
fi
The file would have been created as a sample without replacing root's crontab.

The irony is that my PC is never on at 4am so I will have to do some editing.
 
Old 03-05-2009, 03:55 PM   #7
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
Quote:
Probably not a big issue if you have a strong multi-core machine, but it makes a hell of a difference on my P3-800.
I do the same thing on my box. I have a dual core box but I still prefer using nice as background tasks should never get in my way.

Quote:
The irony is that my PC is never on at 4am so I will have to do some editing.
Yes, the overall design philosophy is for dedicated 24/7 servers rather than desktops. So modify the cron schedule to fit your usage needs. Running cron jobs on a desktop is a tad more challenging than a 24/7 server. Some people use anachron. I wrote a shell script to do much the same:

Missed Cron Jobs
 
Old 03-05-2009, 04:06 PM   #8
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
My Desktop runs 24/7 too
 
  


Reply


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 change the default crontab editor kawatom Red Hat 5 03-06-2011 01:07 PM
crontab -l (default settings ???) czezz Solaris / OpenSolaris 5 07-25-2008 04:35 AM
crontab to add default gateway daemonkl Linux - Newbie 3 12-01-2007 08:19 PM
Crontab: How to change the default notification E-mail address? rignes Linux - Software 4 04-04-2007 02:21 PM
how can I change the default editor (vipw, crontab -e) or pager? Xavius Linux - Newbie 1 04-05-2004 01:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:42 AM.

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