Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
 

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: How to set up 'cron' for a frugal install.< Next Oldest | Next Newest >
gjhicks Offline





Group: Members
Posts: 108
Joined: April 2004
Posted: May 29 2006,12:10 QUOTE

Hi,

Am using a frugal install DSL to run a server box, that is up all the time.  The various logs grow (alarmingly!) over time, specially the privoxy logs.

What to do?  After deciding the getting 'logrotate' to work in DSL was too much bother, decided to use a simple a cron job to 'rotate' the logs but no cron in basic DSL.  So, below is how I got cron to work in DSL and to always be available after a reboot.

1) Call a script (as root) like the one below from 'bootlocal.sh'.  It turns out that to get cron to install/function, a 'mail transport agent' is required.  Although I may well be wrong, it seemed that 'masqmail' was the simplest/smallest to install.

#--------------------------------------------------------------------
#!/bin/sh
#
# Set up the alias file to be writeable, for installation
# of cron et al deb files. Setup /var/mail directory and
# mail user and group

rm /etc/aliases
rm /etc/aliases.db

cp /KNOPPIX/etc/aliases /etc/aliases
cp /KNOPPIX/etc/aliases.db /etc/aliases.db

mkdir /var/mail
groupadd mail
useradd mail -g mail

# Install cron, mail and helper deb files,
# example of 'debcron' file is below
dpkg -i `cat /home/dsl/debcron`

# setup cron editor to use 'nano'
ln -s /bin/nano-tiny /usr/bin/editor
#--------------------------------------------------------------------

2) This is what my 'debcron' file looks like, the deb files are kept on a partition separate from the frugal install partition.  The 'dpkg -i' line in the script 'reads' each line of this list and installs the deb files.

/mnt/hda7/cron_3.0pl1-72_i386.deb
/mnt/hda7/libident_0.22-2_i386.deb
/mnt/hda7/liblockfile1_1.03_i386.deb
/mnt/hda7/libperl5.6_5.6.1-8.9_i386.deb
/mnt/hda7/masqmail_0.1.16-2.1_i386.deb
/mnt/hda7/mailx_1%3a8.1.2-0.20020411cvs-1_i386.deb


3) A script file to 'rotate' the log files, modify to suit other process logs, to be called by cron.

#--------------------------------------------------------------------
#!/bin/sh -
# This is an attempt to write a script to manually
# rotate the some-process log files.
#

if [ -f /home/dsl/some-process/log/logfile.old.2.gz ] ; then
rm /home/dsl/some-process/log/logfile.old.2.gz
fi

if [ -f /home/dsl/some-process/log/logfile.old.1.gz ] ; then
mv /home/dsl/some-process/log/logfile.old.1.gz /home/dsl/some-process/log/logfile.old.2.gz
fi

if [ -f /home/dsl/some-process/log/logfile ] ; then
mv /home/dsl/some-process/log/logfile /home/dsl/some-process/log/logfile.old.1
gzip /home/dsl/some-process/log/logfile.old.1
touch /home/dsl/some-process/log/logfile
fi

# restart process
/usr/bin/killall -HUP /etc/init.d/some-process restart
#--------------------------------------------------------------------

4) I used 'crontab -e' to open the crontab control file and added a line like below, to run the cron job, in this case at midnight each day, with cron output not logged:

0 0 * * * /home/dsl/remove-log.sh >dev/null 2>&1


Hope that the above is of some use.

Geoff.
Back to top
Profile PM 
Fook Offline





Group: Members
Posts: 2
Joined: June 2006
Posted: June 13 2006,14:23 QUOTE

please tell us, where to get your "debcron"-package or where to download a final cron.dsl.
i'm no debian-user at all (prefer FreeBSD), so i've no access to debian-packages via dpkg or else and unfortunatly the little DSL-Computer has no networkconnection at all.

thx for your work. :-)
Fook.
Back to top
Profile PM 
newOldUser Offline





Group: Members
Posts: 241
Joined: Oct. 2004
Posted: June 13 2006,15:46 QUOTE

Fook,

If you can't install cron or run into problems trying to do it there is an alternative way to schedule tasks. These threads talks about it:
In the forum
In the blog area


--------------
======== Note =========
The DSL Forum Search default is 'OR'
If you search for "cat dog" you will get all "cat" posts and all "dog" posts.
If you search for "cat AND dog" you will only find results that contain BOTH "cat" and "dog"
Add '*' for wildcards, " cat* and dog* "
Back to top
Profile PM 
Fook Offline





Group: Members
Posts: 2
Joined: June 2006
Posted: June 14 2006,04:47 QUOTE

Thank you very much for your great scripts, newOldUser :)
Back to top
Profile PM 
3 replies since May 29 2006,12:10 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

 
reply to topic new topic new poll
Quick Reply: How to set up 'cron' for a frugal install.

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code