Koozali.org: home of the SME Server

cron problems

osiris9510

cron problems
« on: February 10, 2006, 12:36:17 AM »
Ok, once again I am completely baffled.

I have a cron job that runs once a week for a backup.

//

30 23 * * 4 /scripts/autorun/backup.sh

//

Pretty cut-and-dry. It works great.

Today, I added the following lines to the same cron tab file:
(I was using these times just to test the usage)

//

05 18 * * * /scripts/autorun/netdown.sh
06 18 * * * /scripts/autorun/netup.sh

//

Here are the contents of both scripts:

//netdown.sh
ifconfig eth0 down
//

//netup.sh
ifconfig eth0 10.1.1.1 netmask 255.255.255.0 up
//

Manually started, both work quite normally, but neither will work in the bloody cron tab!

I have restarted the cron daemon (I had to kill the cron process). I even restarted the server.

What am I missing?

osiris9510

cron problems
« Reply #1 on: February 10, 2006, 03:24:25 PM »
Still scratching my head as to why that didn't work, but this is what SME wants you to do....their way I suppose.  8-)

1) CREATE NEW CRONTAB TEMPLATE

    pico /etc/e-smith/templates/etc/crontab/25clearRecycleBins


Paste the following:

    # Delete files older than X days from all Recycle Bin directories
    39 2 * * * root find /home/e-smith/files/*/*/*/Recycle\ Bin -type f -atime +15 -exec rm \{\} \;
    39 1 * * * root find /home/e-smith/files/*/*/Recycle\ Bin -type f -atime +15 -exec rm \{\} \;
    39 3 * * * root find /home/e-smith/files/*/*/*/Recycle\ Bin/* -type d -empty -print -exec rmdir '\{\}' \;
    39 4 * * * root find /home/e-smith/files/*/*/Recycle\ Bin/* -type d -empty -print -exec rmdir '\{\}' \;


Quit and save the file (ctrl+x and then answer yes to save the file)

NOTE: Here is what you can change in those lines:

    * -atime +15 : means olders than 15 days you can change the +15 value to +10, +30 etc..
    * althought you may change the time those cron jobs are launched: 39 2 * * * means everyday at 2:39 am (man crontab for more infos)

2) EXPAND /etc/crontab

    /sbin/e-smith/expand-template /etc/crontab


3) DONE!


Modify that to suit your needs

CHEERS!  :pint: