Date: Fri, 01 Apr 2005 14:00:14 -0600 From: Eric Anderson <anderson@centtech.com> To: Kris McElroy <kris.mcelroy@duracom.net> Cc: freebsd-isp@freebsd.org Subject: Re: Cron and File Manipulation Message-ID: <424DA84E.4060206@centtech.com> In-Reply-To: <200504011303920.SM01232@KrisLaptop> References: <200504011303920.SM01232@KrisLaptop>
next in thread | previous in thread | raw e-mail | index | archive | help
Kris McElroy wrote: > First of all I am a newbie to FreeBSD and if I need to be pointed somewhere > else let me know. > > I have 2 questions > > I have a .sh script that I want to run every 25 minutes everyday > So would I do the following: > 25 * * * * root /usr/local/bin/MY.sh > > /dev/null 2>&1 > > > Also in the above script I want to add a line in my log file > > Echo >> MY SH Completed > > The thing is I would like to date and timestamp it, how could I do that? Hey Kris! Welcome to FreeBSD.. These are pretty basic Unix essentials, and you might like reading through parts of the FreeBSD handbook (available on the freebsd.org website). On your crontab, you've actually got it set to run at 25minutes after the hour, every hour, not every 25 minutes. You can have it run every 20 minutes for example, by doing this: */20 * * * * root /usr/local/bin/MY.sh > /dev/null 2>&1 That would run on any minute divisible by 20. For date/timestamping, a simple way could be: echo -n `date` >> logfile echo ": normal log text" >> logfile Eric -- ------------------------------------------------------------------------ Eric Anderson Sr. Systems Administrator Centaur Technology A lost ounce of gold may be found, a lost moment of time never. ------------------------------------------------------------------------
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?424DA84E.4060206>