![]() |
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]() |

|
| Linux and Unix Error ! Redhat,suse,centos,mandrake,Free BSD,Sun |
![]() |
|
How to run a cron job every two weeks for a script and if it can be done how do you s
|
LinkBack | Thread Tools | Display Modes |
|
|
#1 (permalink) |
|
Administrator
Posts: 18,712
Join Date: Jan 2006
Rep Power: 10
IM:
|
|
|
|
|
|
|
|
|
|
#2 (permalink) |
|
Administrator
Posts: 18,712
Join Date: Jan 2006
Rep Power: 10
IM:
|
01 * * * * hourlycmd runs every hour at :01 02 4 * * * dailycmd runs at 4:02 am everyday 22 4 * * 0 weeklycmd runs each week on sunday (0 day) at 4:22 am 42 4 1 * * monthlycmd runs the first day of each month at 4:42am As far as I know you can't make cron do something every other two weeks. But in the script you call with cron you can add a test to see if you ran last week or not, so effectively it will only run every two weeks. Use this: if test -f /somedir/ranlastweek then rm /somedir/ranlastweek exit fi touch /somedir/ranlastweek #touch creates the file or if it already exists updates its timestamps The commands you want to run every two weeks here (props to omarfarid for this simple script) |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|