1832162 Members
3128 Online
110038 Solutions
New Discussion

crontab entry

 
subodhbagade
Regular Advisor

crontab entry

Hello expert,

I have one of the backup script whose crontab entry is missing. back up is updating every day on particular file system.
Script is:---------

#!/bin/ksh
cd /db_backup
nohup compress *.1
nohup compress *.2
echo "compression complete" > compit
find . -mtime -7 -mtime +1 > delit
find ohr* -mtime -1 > copyit
for i in `cat copyit`
do
nohup cp $i /ignite-backup/backups/db_backup
done
for i in `cat delit`
do
rm $i
done

As per the crontab i am making this entry ,please comment on this .

min hr date month dayofweek cmd
0 18 1,15 * 1-5 /ignite-backup/backups/db_backup
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor

Re: crontab entry

Hi:

I presume that you want a comment about the crontab scheduling:

Your command will run every Monday through Friday (inclusive) *including* the 1st and the 15th of every ("*") month t 1800.

See the 'crontab' manpages.

Regards!

...JRF...
piyush mathiya
Trusted Contributor

Re: crontab entry

Hi subodh,
It seems that it will run on every 1st and 15th of the month if there is mon-fri, otherwise it will not run, it will run at evening 6 o'clock if first condition match. . .

Regards,
Piyush Mathiya
SKR_1
Trusted Contributor

Re: crontab entry

Please provide your exact requirement. When you exactly want to run this script, specify the time date and days as well when you need to execute this script.

Your crontab entry is not proper. I am not understanding why u have specify 1-5.

Thanks

SKR
Dennis Handly
Acclaimed Contributor

Re: crontab entry

What do you expect to do with those nohups scattered in your script? This isn't going to help because the next step may be aborted.
Also, since the script is started from cron, there won't be any hangup signals.

Note your last for-loop can be replaced by:
rm $(< delit)
And similarly the other:
nohup cp $(< copyit) /ignite-backup/backups/db_backup