check mail backup cron job


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting check mail backup cron job
# 1  
Old 02-28-2011
check mail backup cron job

i have just installed a cron job to run at 3 in the morning once a week. It's difficult for me to test if it works because the email backup program takes the email service down before running the backup. I wondered if i could ask you gurus if this would work?

Code:
0       3       *       *       0       if cd /Volumes/Files_Backup_1;then /usr/sbin/mailbfr -b /Volumes/Files_Backup_1/mail/bak --mode rotate; fi

It's just meant to check that the backup disk is reachable before running mailbfr. This part of the script works
Code:
/usr/sbin/mailbfr -b /Volumes/Files_Backup_1/mail/bak --mode rotate

I just wanted to check that the if then fi stuff would work from a cron job?
# 2  
Old 02-28-2011
Quote:
0 3 * * 0 if cd /Volumes/Files_Backup_1;then /usr/sbin/mailbfr -b /Volumes/Files_Backup_1/mail/bak --mode rotate; fi
Syntax looks ok, but the following syntax would be more robust if the directory might not be there:
Code:
0 3 * * 0 [ -d /Volumes/Files_Backup_1 ] && cd /Volumes/Files_Backup_1 &&  /usr/sbin/mailbfr -b /Volumes/Files_Backup_1/mail/bak --mode rotate

Personally I'd put the whole lot in a script and run the script from cron.
This User Gave Thanks to methyl For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Cron job - Need to run Cron every quarter at particular time

Hi, 1) If some job supposed to run on 1st of every month at 7 AM In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day? 2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct) And if 25th... (5 Replies)
Discussion started by: System Admin 77
5 Replies

2. Shell Programming and Scripting

CRON JOB not running - for tape backup from root user

I am trying a cron on root user to backup to tape using TAR command here is the cron entry 11 08 * * 6 /erdhot1cron 2>&1 >> /test3/scripts/dba/erdhot1cron.log here is script inside - edhot1cron #!/bin/bash vsysdt=`date +%d%m%y` date tar -cvf /dev/st0... (4 Replies)
Discussion started by: vijaymec50
4 Replies

3. Shell Programming and Scripting

Commented cron job -- cron monitoring

Hi I have a requirement to write a shell script,that will check the all commented job in cron job.Please help !! (2 Replies)
Discussion started by: netdbaind
2 Replies

4. UNIX for Dummies Questions & Answers

Double Check my Cron Job

Hello All, I was wondering if someone could take a quick glance at this Cron job and tell me if it's going to do what I am expecting. I want it to run everyday at 8:00 am and 5:00 pm. And the line in Crontab looks like: 0 8,17 * * * /usr/local/myScript.sh Does that look correct? ... (6 Replies)
Discussion started by: mrm5102
6 Replies

5. Solaris

Cron job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

6. Shell Programming and Scripting

how to run a script using cron job and send the output as attachment via e-mail using unix

how to run a script using cron job and send the output as attachment via e-mail using unix. please help me. how my cron job entry should be? As of now my cron job entry is to run the script at specific time, 15 03 * * * /path/sample.sh | mail -s "Logs" email_id In the above entry, what... (8 Replies)
Discussion started by: vidhyaS
8 Replies

7. UNIX for Dummies Questions & Answers

Check that backup MX actually does its job

Hey! I have just configured an backup MX using Mail::Toaster under FreeBSD. As I'm a novice when it comes to mailservers, I need to ask someone how to check that this backup really does its job. My primare MX is unfortunately on a Dynamic IP line, but its unsusual for it to change the IP.... (4 Replies)
Discussion started by: noratx
4 Replies

8. Solaris

cron job starts new cron proccess

I run cron in solaris 10 zone. One cron job which syncing files to nfs mounted on container, creates after finishing another cron proccess(/usr/sbin/cron), and after 100 existing cron proccesses next cron job will not start. It's too weird for me, I'm not able to solve this problem. Theoretically... (3 Replies)
Discussion started by: ron76
3 Replies

9. Shell Programming and Scripting

Backup with shell program and cron job.

Hi, The object of my program is to take automatic backup on daily basis to different folders. I have created the respective folders. when I execute below given shell program manually it is working perfectly and taking the backup to respective folder. #!/bin/sh #script to take backup on... (1 Reply)
Discussion started by: jarkvarma
1 Replies

10. UNIX for Dummies Questions & Answers

Cron Sends mail to root on completion of job.

All I am running a few scripts through a cron job. This is for checking some key services that are running on by box. The problem is, everytime the cron runs, it sends a mail to the root account. The root account mails need to cleared every now and then. Is there some way I can stop these... (1 Reply)
Discussion started by: skotapal
1 Replies
Login or Register to Ask a Question