Re: run cron every four weeks?
From: Chris F.A. Johnson (c.f.a.johnson_at_rogers.com)
Date: 08/11/03
- Next message: Steve Hyatt: "How To Determine Interface Traffic Statistics"
- Previous message: Barry Margolin: "Re: FILE I/O"
- Maybe in reply to: LHradowy: "run cron every four weeks?"
- Next in thread: Floyd Davidson: "Re: run cron every four weeks?"
- Reply: Floyd Davidson: "Re: run cron every four weeks?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 11 Aug 2003 21:47:53 GMT
On Mon, 11 Aug 2003 at 21:33 GMT, Joan Valduvieco wrote:
> Hi
> I would prefer an slightly modified version.
> Here it goes:
>
> #!/bin/bash
>
> . counterfile
>
> counter=$(( $counter + 1 ))
>
> if [ $counter == 4 ]
> then
> counter=0
> do all the rest of the stuff
> fi
> echo "counter=$counter" > counterfile
You can save another line with:
. counterfile
counter=$(( $counter + 1 % 4 ))
if [ $counter -eq 0 ] ## more portable than ==
then
do all the rest of the stuff
fi
echo "counter=$counter" > counterfile
--
Chris F.A. Johnson http://cfaj.freeshell.org
===================================================================
My code (if any) in this post is copyright 2003, Chris F.A. Johnson
and may be copied under the terms of the GNU General Public License
- Next message: Steve Hyatt: "How To Determine Interface Traffic Statistics"
- Previous message: Barry Margolin: "Re: FILE I/O"
- Maybe in reply to: LHradowy: "run cron every four weeks?"
- Next in thread: Floyd Davidson: "Re: run cron every four weeks?"
- Reply: Floyd Davidson: "Re: run cron every four weeks?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|