Help Creating Daily Cron Job


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help Creating Daily Cron Job
# 1  
Old 12-19-2008
Help Creating Daily Cron Job

I need to create a cron job that will run daily to change permissions to a particular folder to 666 every 24hrs.

I have no experience with crontab or cron jobs at all so if someone can guide me through this it would be a great help.

The folder's example is 'www/test/htdocs'

Also if you can show me how to run the same permission every 12 hrs that would be great as well.

Thanks sooo much in advance
# 2  
Old 12-19-2008
cron will use a crontab. You will need to run the crontab -e command to edit the crontab. The cron file has a format of 5 date fields followed by the command you want to execute.
The date fields are laid out as
Field Allowed values

minute 0-59

hour 0-23

day of month 1-31

month 1-12 (or names, see below)

day of week 0-7 (0 or 7 is Sun, or use names)

A field can be an asterisk (*), which always stands for first-last.

So to run you command every 24 hrs at 11:00pm you would edit the crontab and enter

00 11 * * * chmod 666 /www/test/htdocs
# 3  
Old 12-19-2008
Sorry the 11 shoudl have been a 23 to run at 11:00pm before. If you need to run every 12 ours once at 11:00am and 11:00pm then enter

00 11,23 * * * chmod 666 /www/test/htdocs
# 4  
Old 12-19-2008
Thank you soo much it was very easy to follow. As soon as I am done I will update the post.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run script no more than twice daily WITHOUT cron

Can I run a script no more than twice a day without using cron? Maybe create a file when script is first run and check its date? (7 Replies)
Discussion started by: drew77
7 Replies

2. UNIX for Beginners Questions & Answers

/etc/cron.daily script is not being executed

Hi All I have created a file in /etc/cron.daily on redhat linux 7.3 version host called applicationscript cat applictaionscript #!/bin/bash /prod/data/routine.sh cat /prod/data/routine.sh #!/bin/bash #details regular=/prod/data/jboss/logs backup=/prod/data/logs #echo "Moving logs"... (3 Replies)
Discussion started by: anil529
3 Replies

3. 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

4. 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

5. UNIX for Dummies Questions & Answers

logrotate and cron.daily/weekly

Hi guys, I've got two separate logrotates I'd like to run, one for Tomcat and one for Apache, but I'd like to run the Tomcat one daily and the Apache one weekly. Now, the logrotate itself is working fine, but although I have 'daily' in Tomcat, and 'weekly' in the Apache one, the latter is... (2 Replies)
Discussion started by: jimbob01
2 Replies

6. Shell Programming and Scripting

Creating directory daily basis...

Need help on this script. the month is not changing to February... #!/bin/bash for X in `seq 1 100` do DATE=`date +%Y-%m-%d "--date=${X} day ago"` Y=`date +%Y` M=`date +%m` D=`date +%d "--date=${X} day ago"` DIR=/home/LogBackup for i in `seq 1 ` do if ;then # ... (1 Reply)
Discussion started by: alelee
1 Replies

7. Shell Programming and Scripting

List all daily scheduled cron jobs from my cronfile

I had a cron file named mycron.cron and this file has cron jobs runs through out 365 days (jobs in the file mycron.cron run hourly, daily, weekly, monthly, quarterly and yearly). Is there an easy way to find what are the jobs scheduled today and what time they are scheduled to run? Thanks in... (1 Reply)
Discussion started by: sureng
1 Replies

8. UNIX for Dummies Questions & Answers

Showing a daily backup job from a unique log file.

Hi guys, I´m a newbie in Linux, but I´m trying to solve some problems studying on my own, but I´ve had some problems with AWK. Look, I have one single backup log file per server and I want to make a daily delection from the last backup job to show in a intranet of my work. The log files are from... (0 Replies)
Discussion started by: metalfreakbr
0 Replies

9. UNIX for Dummies Questions & Answers

cron.daily

At what time does cron.daily implement and how can i change this or set it etc? Thanks in advance. (5 Replies)
Discussion started by: ITFcraig
5 Replies

10. Linux

Need Help with creating a Cron Job

Hello Guys. I really need some help creating a cron job. I want to back up my mySQL database, which runs a phpBB Forum. I need the backup to run every 6 hours - but the host can make it run every 6 hours. I need it to backup to a directory called Backups (on the root) and i dont want it... (1 Reply)
Discussion started by: dhoodle
1 Replies
Login or Register to Ask a Question