Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-08-2006, 02:58 AM   #1
Registered: May 2006
Posts: 100

Rep: Reputation: 15
Bash script and cron job

Please let me know the steps are correct.

First, I create a bash script file called in /usr/local/bin

The contents look like this:

find /u1/database/prod -type f -print | grep -v 'gz' | xargs gzip
echo "done"

I then make an executable file by

chmod +x

I want to add this to the cron job to run every hour so

crontab -e

0 * * * * /usr/local/bin/

Also to comment out other existing jobs in the cron table do I just add a # in front of them and close the cron file by pressing CTRL C?
Old 07-08-2006, 03:37 AM   #2
LQ Newbie
Registered: Jun 2006
Posts: 25

Rep: Reputation: 15
u have to use crontab -e like vi viewer...
to save changes press ESC and type :wq
w means write
q means quit

if u dont want to save changes press ESC and type :q!
q! means quit without saving

afterall u can look your crontab by type crontab -l
Old 07-08-2006, 07:45 AM   #3
Registered: May 2006
Posts: 100

Original Poster
Rep: Reputation: 15
find /u1/database/prod -type f -print | grep -v 'gz' | xargs gzip > /usr/local/bin/arch.out

Why does the above not create a arch.out in /usr/local/bin when it has completed?

Instead it tells me that I have mail in /var/spool/mail/root


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Job with a Script bravored Linux - General 4 08-05-2005 10:27 AM
cron job for expect script ruchitadesai Programming 9 05-27-2005 04:34 AM
Cron Job not running ssh script karim0028 Linux - General 3 02-07-2005 12:08 PM
Trouble with perl script in Cron job thack111 Linux - General 7 11-25-2004 02:44 AM
script not running as a cron job sanjith11 Programming 5 11-23-2004 08:42 AM

All times are GMT -5. The time now is 04:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration