Re: crontab question involving cvsup

2004-08-28 Thread Viktor Lazlo
On Thu, 26 Aug 2004, Joshua Tinnin wrote:

  man cron gives:
  
  crontab [-u user] file
  
  'file' being the important part, methinks.   ;)
  
  I'm not sure what you mean ... If you're wondering, I'm using the
   main crontab file (/etc/crontab), as right now there's no need for
   me to use multiple ones.
 
  Just an aside, but a rather important one:  /etc/crontab is the
  *system* crontab and shouldn't have your jobs in it.  It may in fact
  be this issue that is causing the problem, but I've not looked into
  it enough to say unequivocally...

 I don't think this is true. For one thing, as suggested, directing
 output of cvsup to /dev/null worked, and now my cron job is working.
 Another is that neither the handbook nor the /etc/crontab file itself
 warn about editing it. In fact, the handbook section 11.6 says,
 Important: You must not use the procedure described here to
 edit/install the system crontab. Simply use your favorite editor: the
 cron utility will notice that the file has changed and immediately
 begin using the updated version. This is what I did. I didn't use the
 crontab command to edit/install it, I just used an editor.

  Since your job needs root privileges, you should put this in root's
  crontab, either by su'ing to root and running crontab -e at the
  prompt, or if you have sudo installed, sudo crontab -e will get you
  there.
 
  Unlike the system crontab, user crontabs, including root's, are
  under /var/cron; the file format is slightly different, and misuse
  of the system crontab for regular jobs is the cause of several
  FAQ posts we see here every few months or so; one of these goes
  something like, why do I get an email from cron saying it can't
  complete my job, unknown user, etc. ??

 Again, I see nothing in the documentation warning against editing the
 system crontab file, only that it can't be installed/edited with the
 crontab command.

The main danger in using /etc/crontab is that it can easily be wiped out
during system updates, while user crontabs will not be affected.
/etc/crontab does also use a slightly different format from user crontabs,
which you need to be aware of if transferring entries between them.

Cheers,

Viktor
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-27 Thread Joshua Tinnin
On Thursday 26 August 2004 04:04 pm, Kevin D. Kinsey, DaleCo, S.P. 
[EMAIL PROTECTED] wrote:
 Joshua Tinnin wrote:
 On Thursday 26 August 2004 08:28 am, Kevin D. Kinsey, DaleCo, S.P.
 
 [EMAIL PROTECTED] wrote:
 Unlike the system crontab, user crontabs, including root's, are
 under /var/cron; the file format is slightly different, and misuse
 of the system crontab for regular jobs is the cause of several
 FAQ posts we see here every few months or so; one of these goes
 something like, why do I get an email from cron saying it can't
 complete my job, unknown user, etc. ??
 
 Again, I see nothing in the documentation warning against editing
  the system crontab file, only that it can't be installed/edited
  with the crontab command.
 
 - jt

 Well, you *can* do it that way ... but I wouldn't.  No flub up of
 mine when running mergemaster is going to touch /var/cron/tabs/root;
 OTOH, if I put my script calls in /etc/crontab ...

OK, what you said makes much more sense now. See, I'm the kind of person 
who has to know *exactly* why I shouldn't put my hand in the burning 
fire, or if not I just might do it ;)

 My point was that /etc/crontab is there for the machine, and
 per-user crontabs are there for the users --- and that includes
 root, so why not use it for what it's for?

 Of course, one of the nice things about BSD, if you know
 how and why, you can do it any way you like, almost...

Yes, although I do plan on upgrading to 5.3 (from 5.2.1) once it goes to 
STABLE, so it's probably best if I put this cron job in the primary 
user's crontab file.

- jt
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: crontab question involving cvsup

2004-08-26 Thread Ivailo Tanusheff
 

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Joshua Tinnin
Sent: Thursday, August 26, 2004 10:07 AM
To: FreeBSD-questions
Subject: crontab question involving cvsup

OK, I have searched the archives, and I can't find that my question has been
answered previously, but please forgive me if that's incorrect.

I'm using (or rather trying to use) cron to update my ports tree daily. 
I've tried several different combinations without success, and lately this
is what I have in my crontab file:

/usr/local/bin/cvsup -g -L 2 /home/krinklyfig/supfiles/ports-supfile
 /usr/local/bin/portindex  /usr/local/sbin/portsdb -u

It runs as root once a day. What appears to be happening is that the cvsup
is happening, but portindex is not, and because of the latter portsdb -u
doesn't either. The reason I know cvsup is working is because portindex
indicates that the ports tree has been updated if I run it manually later,
but running portversion before manually running portindex will not indicate
any changes. The cron log doesn't show anything but the commands being
executed. So, my question is: is this type of command valid, or should each
command be separate? Or is it not working for some other reason?

- jt


Hi,

I'll suggest you to use /usr/local/sbin/portsdb -uU instead of
/usr/local/bin/portindex  /usr/local/sbin/portsdb -u
It works perfect with me :)

Regards,
Ivailo Tanusheff

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Subhro Kar
First of all, you need to read the manual page for cvsup. It is
clearly stated that the option -L shows the amount of verbosity cvsup
maintains. If you are running it from inside a script, then either you
have to
reduce the verbosity to 1 ie, the command will be cvsup -g -L 1 supfile
OR
redirect the output to some file (if you want to look into it later)
or to /dev/null to discard it.

Secondly, You can always set up multiple crontabs. But since you are
using  (ie doo only if prev was successful), that would works if the
output of cvsup is properly dealt with.

Regards

S.


On Thu, 26 Aug 2004 00:07:26 -0700, Joshua Tinnin [EMAIL PROTECTED] wrote:
 OK, I have searched the archives, and I can't find that my question has
 been answered previously, but please forgive me if that's incorrect.
 
 I'm using (or rather trying to use) cron to update my ports tree daily.
 I've tried several different combinations without success, and lately
 this is what I have in my crontab file:
 
 /usr/local/bin/cvsup -g -L 2 /home/krinklyfig/supfiles/ports-supfile
  /usr/local/bin/portindex  /usr/local/sbin/portsdb -u
 
 It runs as root once a day. What appears to be happening is that the
 cvsup is happening, but portindex is not, and because of the latter
 portsdb -u doesn't either. The reason I know cvsup is working is
 because portindex indicates that the ports tree has been updated if I
 run it manually later, but running portversion before manually running
 portindex will not indicate any changes. The cron log doesn't show
 anything but the commands being executed. So, my question is: is this
 type of command valid, or should each command be separate? Or is it not
 working for some other reason?
 
 - jt
 ___
 [EMAIL PROTECTED] mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 


-- 
Subhro Sankha Kar
School of Information Technology
Block AQ-13/1 Sector V
ZIP 700091
India
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread epilogue
On Thu, 26 Aug 2004 00:07:26 -0700
Joshua Tinnin [EMAIL PROTECTED] wrote:

 OK, I have searched the archives, and I can't find that my question has 
 been answered previously, but please forgive me if that's incorrect.
 
 I'm using (or rather trying to use) cron to update my ports tree daily. 
 I've tried several different combinations without success, and lately 
 this is what I have in my crontab file:
 
 /usr/local/bin/cvsup -g -L 2 /home/krinklyfig/supfiles/ports-supfile 
  /usr/local/bin/portindex  /usr/local/sbin/portsdb -u
 
 It runs as root once a day. What appears to be happening is that the 
 cvsup is happening, but portindex is not, and because of the latter 
 portsdb -u doesn't either. The reason I know cvsup is working is 
 because portindex indicates that the ports tree has been updated if I 
 run it manually later, but running portversion before manually running 
 portindex will not indicate any changes. The cron log doesn't show 
 anything but the commands being executed. So, my question is: is this 
 type of command valid, or should each command be separate? Or is it not 
 working for some other reason?

man cron gives:

crontab [-u user] file

'file' being the important part, methinks.   ;)

what you might want to do, is simply write a shell script and feed that
into your crontab.  in case you're not sure how to make a script, it is
very simple and google will return many tutorials.

in a nutshell, you put the commands you want into a file, make that file
executable (chmod), and away you go.

the first line of a shell script has an obligatory format and invokes the
shell that will be used.

#!/bin/sh   the leading # is required
/usr/local/bin/cvsup -L 2 /foo/path/to/your/ports-supfile;
# comments are allowed
portindex;
exit

note: you might also prefer to end commands with  rather than ;

i'm new to scripting myself so please forgive my feeble explanation.

about the commands which you are planning to include, why the 'portsdb -u'?
is that not doing essentially the same work as 'portindex' ?

(http://www.freshports.org/sysutils/portindex/)

anyhow.  hope this helps.


cheers,
epi
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Joshua Tinnin
On Thursday 26 August 2004 12:19 am, Subhro Kar [EMAIL PROTECTED] 
wrote:
 First of all, you need to read the manual page for cvsup. It is
 clearly stated that the option -L shows the amount of verbosity cvsup
 maintains. If you are running it from inside a script, then either
 you have to
 reduce the verbosity to 1 ie, the command will be cvsup -g -L 1
 supfile OR
 redirect the output to some file (if you want to look into it later)
 or to /dev/null to discard it.

Yes, I've read the cvsup man page, but hadn't considered that verbosity 
might cause a failure if it's not directed. I think that might have 
been my problem. I had previously been directing output to a file, but 
not recently.

 Secondly, You can always set up multiple crontabs. But since you are
 using  (ie doo only if prev was successful), that would works if
 the output of cvsup is properly dealt with.

Well, again I know cvsup is working, but I think the verbosity might be 
a problem in executing the next command; i.e., I think since it can't 
direct output, it does run cvsup but fails in the verbosity aspect, 
and therefore no more commands are executed after. In any event, I 
think I'll try it with cvsup -g -L 2 supfile  /dev/null 21 (of 
course with the proper paths) and see what happens, and alternately try 
to direct output to a file the next time, as I'd like to have a log. 
I'll probably also change it to portsdb -Uu as Ivailo suggested, as I 
don't need to have it run quickly when it's a daily job done when I'm 
sleeping.

Thanks for the help.

- jt

 Regards

 S.

 On Thu, 26 Aug 2004 00:07:26 -0700, Joshua Tinnin 
[EMAIL PROTECTED] wrote:
  OK, I have searched the archives, and I can't find that my question
  has been answered previously, but please forgive me if that's
  incorrect.
 
  I'm using (or rather trying to use) cron to update my ports tree
  daily. I've tried several different combinations without success,
  and lately this is what I have in my crontab file:
 
  /usr/local/bin/cvsup -g -L 2
  /home/krinklyfig/supfiles/ports-supfile  /usr/local/bin/portindex
   /usr/local/sbin/portsdb -u
 
  It runs as root once a day. What appears to be happening is that
  the cvsup is happening, but portindex is not, and because of the
  latter portsdb -u doesn't either. The reason I know cvsup is
  working is because portindex indicates that the ports tree has been
  updated if I run it manually later, but running portversion before
  manually running portindex will not indicate any changes. The cron
  log doesn't show anything but the commands being executed. So, my
  question is: is this type of command valid, or should each command
  be separate? Or is it not working for some other reason?
 
  - jt
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Joshua Tinnin
On Thursday 26 August 2004 12:42 am, epilogue [EMAIL PROTECTED] 
wrote:
 On Thu, 26 Aug 2004 00:07:26 -0700

 Joshua Tinnin [EMAIL PROTECTED] wrote:
  OK, I have searched the archives, and I can't find that my question
  has been answered previously, but please forgive me if that's
  incorrect.
 
  I'm using (or rather trying to use) cron to update my ports tree
  daily. I've tried several different combinations without success,
  and lately this is what I have in my crontab file:
 
  /usr/local/bin/cvsup -g -L 2
  /home/krinklyfig/supfiles/ports-supfile  /usr/local/bin/portindex
   /usr/local/sbin/portsdb -u
 
  It runs as root once a day. What appears to be happening is that
  the cvsup is happening, but portindex is not, and because of the
  latter portsdb -u doesn't either. The reason I know cvsup is
  working is because portindex indicates that the ports tree has been
  updated if I run it manually later, but running portversion before
  manually running portindex will not indicate any changes. The cron
  log doesn't show anything but the commands being executed. So, my
  question is: is this type of command valid, or should each command
  be separate? Or is it not working for some other reason?

 man cron gives:

 crontab [-u user] file

 'file' being the important part, methinks.   ;)

I'm not sure what you mean ... If you're wondering, I'm using the main 
crontab file (/etc/crontab), as right now there's no need for me to use 
multiple ones.

 what you might want to do, is simply write a shell script and feed
 that into your crontab.  in case you're not sure how to make a
 script, it is very simple and google will return many tutorials.

I had considered this, and eventually would like to do so, as I'd like 
to add the output of fastest_cvsup to the server listed in the supfile.

 in a nutshell, you put the commands you want into a file, make that
 file executable (chmod), and away you go.

 the first line of a shell script has an obligatory format and invokes
 the shell that will be used.

 #!/bin/sh   the leading # is required
 /usr/local/bin/cvsup -L 2 /foo/path/to/your/ports-supfile;
 # comments are allowed
 portindex;
 exit

Is verbosity of -L 2 allowed in a script without output? IOW, should 
that first line be:

/usr/local/bin/cvsup -L 2 /path/to/supfile  /dev/null 21;

Or does it matter if the output has nowhere to go?

 note: you might also prefer to end commands with  rather than ;

 i'm new to scripting myself so please forgive my feeble explanation.

I'm pretty new to scripting as well. Does ; allow the next line to run, 
even if the previous one didn't, as opposed to  which would only 
allow the next line to run if the previous one was successful? (This 
would be similar to how a one-line command works outside a script.)

 about the commands which you are planning to include, why the
 'portsdb -u'? is that not doing essentially the same work as
 'portindex' ?

 (http://www.freshports.org/sysutils/portindex/)

No, portindex doesn't update the database. The command portsdb -U 
generates an INDEX, which is what portindex does (although portindex 
does it faster), while portsdb -u generates the INDEX.db from the ports 
INDEX file. However, the database is generated automatically if need be 
when it's looked up, so it's not necessary - man portsdb mentions this 
- but I like to have my ducks in a row, so to speak ;)

 anyhow.  hope this helps.

Yes, it has me thinking I should probably start testing out a script, 
but it will include a bit more than just cvsup'ping, updating the INDEX 
and database. Thanks.

- jt
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread kstewart
On Thursday 26 August 2004 01:09 am, Joshua Tinnin wrote:
 On Thursday 26 August 2004 12:42 am, epilogue [EMAIL PROTECTED]

 wrote:
  On Thu, 26 Aug 2004 00:07:26 -0700
 
  Joshua Tinnin [EMAIL PROTECTED] wrote:
   OK, I have searched the archives, and I can't find that my question
   has been answered previously, but please forgive me if that's
   incorrect.
  
   I'm using (or rather trying to use) cron to update my ports tree
   daily. I've tried several different combinations without success,
   and lately this is what I have in my crontab file:
  
   /usr/local/bin/cvsup -g -L 2
   /home/krinklyfig/supfiles/ports-supfile  /usr/local/bin/portindex
/usr/local/sbin/portsdb -u
  
   It runs as root once a day. What appears to be happening is that
   the cvsup is happening, but portindex is not, and because of the
   latter portsdb -u doesn't either. The reason I know cvsup is
   working is because portindex indicates that the ports tree has been
   updated if I run it manually later, but running portversion before
   manually running portindex will not indicate any changes. The cron
   log doesn't show anything but the commands being executed. So, my
   question is: is this type of command valid, or should each command
   be separate? Or is it not working for some other reason?
 
  man cron gives:
 
  crontab [-u user] file
 
  'file' being the important part, methinks.   ;)

 I'm not sure what you mean ... If you're wondering, I'm using the main
 crontab file (/etc/crontab), as right now there's no need for me to use
 multiple ones.

  what you might want to do, is simply write a shell script and feed
  that into your crontab.  in case you're not sure how to make a
  script, it is very simple and google will return many tutorials.

 I had considered this, and eventually would like to do so, as I'd like
 to add the output of fastest_cvsup to the server listed in the supfile.

  in a nutshell, you put the commands you want into a file, make that
  file executable (chmod), and away you go.
 
  the first line of a shell script has an obligatory format and invokes
  the shell that will be used.
 
  #!/bin/sh   the leading # is required
  /usr/local/bin/cvsup -L 2 /foo/path/to/your/ports-supfile;
  # comments are allowed
  portindex;
  exit

 Is verbosity of -L 2 allowed in a script without output? IOW, should
 that first line be:

 /usr/local/bin/cvsup -L 2 /path/to/supfile  /dev/null 21;

 Or does it matter if the output has nowhere to go?

  note: you might also prefer to end commands with  rather than ;
 
  i'm new to scripting myself so please forgive my feeble explanation.

 I'm pretty new to scripting as well. Does ; allow the next line to run,
 even if the previous one didn't, as opposed to  which would only
 allow the next line to run if the previous one was successful? (This
 would be similar to how a one-line command works outside a script.)

  about the commands which you are planning to include, why the
  'portsdb -u'? is that not doing essentially the same work as
  'portindex' ?
 
  (http://www.freshports.org/sysutils/portindex/)

 No, portindex doesn't update the database. The command portsdb -U
 generates an INDEX, which is what portindex does (although portindex
 does it faster), while portsdb -u generates the INDEX.db from the ports
 INDEX file. However, the database is generated automatically if need be
 when it's looked up, so it's not necessary - man portsdb mentions this
 - but I like to have my ducks in a row, so to speak ;)

  anyhow.  hope this helps.

 Yes, it has me thinking I should probably start testing out a script,
 but it will include a bit more than just cvsup'ping, updating the INDEX
 and database. Thanks.


This is my cron job. I don't test for completion because of the multiple 
commands I execute. It doesn't fail very often. It also include the usage of 
portindex and portsdb.

ruby# m uports
#! /bin/sh
export 
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin:/root/bin
cd /root/cvsup
cvsup -g -L 2 ports-supfile 21 | tee /var/log/build/ports_cvsup.log

cd /var/log/build

# Now convert the log to html`
cvsuplog  ports_cvsup.log  ports-`date +%Y%m%d-%H%M`.html

# Now update the index pages.
cd /usr/ports
#
# make bzip2 backup and save 4 old ones for the days when make index
# is broken
#
rm INDEX.3.bz2
mv INDEX.2.bz2 INDEX.3.bz2
mv INDEX.1.bz2 INDEX.2.bz2
mv INDEX.0.bz2 INDEX.1.bz2
bzip2 -c INDEX  INDEX.0.bz2
#
# get new INDEX
#make index 21 | tee /var/log/build/make-index-`date +%Y%m%d-%H%M`.log
portindex 21 | tee /var/log/build/make-index-`date +%Y%m%d-%H%M`.log
#
#fetch www.freebsd.org/ports/INDEX
#chmod 644 INDEX
portsdb -u


-- 
Kent Stewart
Richland, WA

http://users.owt.com/kstewart/index.html
Support the Bison at http://www.buffalofieldcampaign.org/
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail 

Re: crontab question involving cvsup

2004-08-26 Thread Kevin D. Kinsey, DaleCo, S.P.
Joshua Tinnin wrote:
On Thursday 26 August 2004 12:42 am, epilogue [EMAIL PROTECTED] 
wrote:
 

On Thu, 26 Aug 2004 00:07:26 -0700
Joshua Tinnin [EMAIL PROTECTED] wrote:
   

OK, I have searched the archives, and I can't find that my question
has been answered previously, but please forgive me if that's
incorrect.
I'm using (or rather trying to use) cron to update my ports tree
daily. I've tried several different combinations without success,
and lately this is what I have in my crontab file:
/usr/local/bin/cvsup -g -L 2
/home/krinklyfig/supfiles/ports-supfile  /usr/local/bin/portindex
 /usr/local/sbin/portsdb -u
It runs as root once a day. What appears to be happening is that
the cvsup is happening, but portindex is not, and because of the
latter portsdb -u doesn't either. The reason I know cvsup is
working is because portindex indicates that the ports tree has been
updated if I run it manually later, but running portversion before
manually running portindex will not indicate any changes. The cron
log doesn't show anything but the commands being executed. So, my
question is: is this type of command valid, or should each command
be separate? Or is it not working for some other reason?
 

man cron gives:
crontab [-u user] file
'file' being the important part, methinks.   ;)
   

I'm not sure what you mean ... If you're wondering, I'm using the main 
crontab file (/etc/crontab), as right now there's no need for me to use 
multiple ones.
 

Just an aside, but a rather important one:  /etc/crontab is the *system*
crontab and shouldn't have your jobs in it.  It may in fact be this issue
that is causing the problem, but I've not looked into it enough to say
unequivocally...
Since your job needs root privileges, you should put this in root's
crontab, either by su'ing to root and running crontab -e at the prompt,
or if you have sudo installed, sudo crontab -e will get you there.
Unlike the system crontab, user crontabs, including root's, are
under /var/cron; the file format is slightly different, and misuse
of the system crontab for regular jobs is the cause of several
FAQ posts we see here every few months or so; one of these goes
something like, why do I get an email from cron saying it can't
complete my job, unknown user, etc. ??
Kevin Kinsey
DaleCo, S.P.
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Lucas Holt
Here is my setup which works:
crontab -e yeilds
0 1 * * *   /bin/sh /root/bin/port.sh 21 | mail root
port.sh contains:
#!/bin/sh
/usr/local/bin/cvsup /etc/ports-supfile
/usr/local/sbin/portsdb -Uu
/usr/local/sbin/portversion -v | /usr/bin/grep 
then this gets mailed to me everyday with the outcome and the ports 
that need updating.

Lucas Holt
[EMAIL PROTECTED]

FoolishGames.com  (Jewel Fan Site)
JustJournal.com (Free blogging)
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Paul Schmehl
--On Thursday, August 26, 2004 12:07:26 AM -0700 Joshua Tinnin 
[EMAIL PROTECTED] wrote:

OK, I have searched the archives, and I can't find that my question has
been answered previously, but please forgive me if that's incorrect.
I'm using (or rather trying to use) cron to update my ports tree daily.
I've tried several different combinations without success, and lately
this is what I have in my crontab file:
/usr/local/bin/cvsup -g -L 2 /home/krinklyfig/supfiles/ports-supfile
 /usr/local/bin/portindex  /usr/local/sbin/portsdb -u
It runs as root once a day. What appears to be happening is that the
cvsup is happening, but portindex is not, and because of the latter
portsdb -u doesn't either. The reason I know cvsup is working is
because portindex indicates that the ports tree has been updated if I
run it manually later, but running portversion before manually running
portindex will not indicate any changes. The cron log doesn't show
anything but the commands being executed. So, my question is: is this
type of command valid, or should each command be separate? Or is it not
working for some other reason?
Just out of curiosity, why would you use cron rather than 
/etc/periodic/daily?

Paul Schmehl ([EMAIL PROTECTED])
Adjunct Information Security Officer
The University of Texas at Dallas
AVIEN Founding Member
http://www.utdallas.edu/ir/security/
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Radek Kozlowski
On Thu, Aug 26, 2004 at 11:48:53AM -0400, Lucas Holt wrote:
 Here is my setup which works:
 
 crontab -e yeilds
 0 1 * * *   /bin/sh /root/bin/port.sh 21 | mail root
 
 port.sh contains:
 #!/bin/sh
 
 /usr/local/bin/cvsup /etc/ports-supfile
 /usr/local/sbin/portsdb -Uu
 /usr/local/sbin/portversion -v | /usr/bin/grep 

portversion -vl  would give the same results.

Also, you might want to give portindex a try, which will do the same
part as portsdb -U, but noticeably faster.

-Radek
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Charles Ulrich

Paul Schmehl said:
 Just out of curiosity, why would you use cron rather than
 /etc/periodic/daily?

If you want something to run at a different time of day than the daily
scripts. You could modify /etc/crontab and move the time around, but the rest
of the scripts still follow and most of us have been trained to never monkey
with files in /etc except a few.

Also, typing 'crontab -e' is extremely simple when all you have to do is run a
single command.

-- 
Charles Ulrich
System Administrator
Ideal Solution - http://www.idealso.com
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Joshua Tinnin
On Thursday 26 August 2004 08:28 am, Kevin D. Kinsey, DaleCo, S.P. 
[EMAIL PROTECTED] wrote:
 Joshua Tinnin wrote:
 On Thursday 26 August 2004 12:42 am, epilogue
  [EMAIL PROTECTED]
 
 wrote:
 On Thu, 26 Aug 2004 00:07:26 -0700
 
 Joshua Tinnin [EMAIL PROTECTED] wrote:
 OK, I have searched the archives, and I can't find that my
  question has been answered previously, but please forgive me if
  that's incorrect.
 
 I'm using (or rather trying to use) cron to update my ports tree
 daily. I've tried several different combinations without success,
 and lately this is what I have in my crontab file:
 
 /usr/local/bin/cvsup -g -L 2
 /home/krinklyfig/supfiles/ports-supfile 
  /usr/local/bin/portindex  /usr/local/sbin/portsdb -u
 
 It runs as root once a day. What appears to be happening is that
 the cvsup is happening, but portindex is not, and because of the
 latter portsdb -u doesn't either. The reason I know cvsup is
 working is because portindex indicates that the ports tree has
  been updated if I run it manually later, but running portversion
  before manually running portindex will not indicate any changes.
  The cron log doesn't show anything but the commands being
  executed. So, my question is: is this type of command valid, or
  should each command be separate? Or is it not working for some
  other reason?
 
 man cron gives:
 
 crontab [-u user] file
 
 'file' being the important part, methinks.   ;)
 
 I'm not sure what you mean ... If you're wondering, I'm using the
  main crontab file (/etc/crontab), as right now there's no need for
  me to use multiple ones.

 Just an aside, but a rather important one:  /etc/crontab is the
 *system* crontab and shouldn't have your jobs in it.  It may in fact
 be this issue that is causing the problem, but I've not looked into
 it enough to say unequivocally...

I don't think this is true. For one thing, as suggested, directing 
output of cvsup to /dev/null worked, and now my cron job is working. 
Another is that neither the handbook nor the /etc/crontab file itself 
warn about editing it. In fact, the handbook section 11.6 says, 
Important: You must not use the procedure described here to 
edit/install the system crontab. Simply use your favorite editor: the 
cron utility will notice that the file has changed and immediately 
begin using the updated version. This is what I did. I didn't use the 
crontab command to edit/install it, I just used an editor.

 Since your job needs root privileges, you should put this in root's
 crontab, either by su'ing to root and running crontab -e at the
 prompt, or if you have sudo installed, sudo crontab -e will get you
 there.

 Unlike the system crontab, user crontabs, including root's, are
 under /var/cron; the file format is slightly different, and misuse
 of the system crontab for regular jobs is the cause of several
 FAQ posts we see here every few months or so; one of these goes
 something like, why do I get an email from cron saying it can't
 complete my job, unknown user, etc. ??

Again, I see nothing in the documentation warning against editing the 
system crontab file, only that it can't be installed/edited with the 
crontab command.

- jt
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Joshua Tinnin
On Thursday 26 August 2004 02:28 am, kstewart [EMAIL PROTECTED] wrote:
 On Thursday 26 August 2004 01:09 am, Joshua Tinnin wrote:
  On Thursday 26 August 2004 12:42 am, epilogue
  [EMAIL PROTECTED]
 
  wrote:
   On Thu, 26 Aug 2004 00:07:26 -0700
  
   Joshua Tinnin [EMAIL PROTECTED] wrote:
OK, I have searched the archives, and I can't find that my
question has been answered previously, but please forgive me if
that's incorrect.
   
I'm using (or rather trying to use) cron to update my ports
tree daily. I've tried several different combinations without
success, and lately this is what I have in my crontab file:
   
/usr/local/bin/cvsup -g -L 2
/home/krinklyfig/supfiles/ports-supfile 
/usr/local/bin/portindex  /usr/local/sbin/portsdb -u
   
It runs as root once a day. What appears to be happening is
that the cvsup is happening, but portindex is not, and because
of the latter portsdb -u doesn't either. The reason I know
cvsup is working is because portindex indicates that the ports
tree has been updated if I run it manually later, but running
portversion before manually running portindex will not indicate
any changes. The cron log doesn't show anything but the
commands being executed. So, my question is: is this type of
command valid, or should each command be separate? Or is it not
working for some other reason?
  
   man cron gives:
  
   crontab [-u user] file
  
   'file' being the important part, methinks.   ;)
 
  I'm not sure what you mean ... If you're wondering, I'm using the
  main crontab file (/etc/crontab), as right now there's no need for
  me to use multiple ones.
 
   what you might want to do, is simply write a shell script and
   feed that into your crontab.  in case you're not sure how to make
   a script, it is very simple and google will return many
   tutorials.
 
  I had considered this, and eventually would like to do so, as I'd
  like to add the output of fastest_cvsup to the server listed in the
  supfile.
 
   in a nutshell, you put the commands you want into a file, make
   that file executable (chmod), and away you go.
  
   the first line of a shell script has an obligatory format and
   invokes the shell that will be used.
  
   #!/bin/sh   the leading # is required
   /usr/local/bin/cvsup -L 2 /foo/path/to/your/ports-supfile;
   # comments are allowed
   portindex;
   exit
 
  Is verbosity of -L 2 allowed in a script without output? IOW,
  should that first line be:
 
  /usr/local/bin/cvsup -L 2 /path/to/supfile  /dev/null 21;
 
  Or does it matter if the output has nowhere to go?
 
   note: you might also prefer to end commands with  rather than ;
  
   i'm new to scripting myself so please forgive my feeble
   explanation.
 
  I'm pretty new to scripting as well. Does ; allow the next line to
  run, even if the previous one didn't, as opposed to  which would
  only allow the next line to run if the previous one was successful?
  (This would be similar to how a one-line command works outside a
  script.)
 
   about the commands which you are planning to include, why the
   'portsdb -u'? is that not doing essentially the same work as
   'portindex' ?
  
   (http://www.freshports.org/sysutils/portindex/)
 
  No, portindex doesn't update the database. The command portsdb -U
  generates an INDEX, which is what portindex does (although
  portindex does it faster), while portsdb -u generates the INDEX.db
  from the ports INDEX file. However, the database is generated
  automatically if need be when it's looked up, so it's not necessary
  - man portsdb mentions this - but I like to have my ducks in a row,
  so to speak ;)
 
   anyhow.  hope this helps.
 
  Yes, it has me thinking I should probably start testing out a
  script, but it will include a bit more than just cvsup'ping,
  updating the INDEX and database. Thanks.

 This is my cron job. I don't test for completion because of the
 multiple commands I execute. It doesn't fail very often. It also
 include the usage of portindex and portsdb.

 ruby# m uports
 #! /bin/sh
 export
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/us
r/X11R6/bin:/root/bin cd /root/cvsup
 cvsup -g -L 2 ports-supfile 21 | tee /var/log/build/ports_cvsup.log

 cd /var/log/build

 # Now convert the log to html`
 cvsuplog  ports_cvsup.log  ports-`date +%Y%m%d-%H%M`.html

 # Now update the index pages.
 cd /usr/ports
 #
 # make bzip2 backup and save 4 old ones for the days when make index
 # is broken
 #
 rm INDEX.3.bz2
 mv INDEX.2.bz2 INDEX.3.bz2
 mv INDEX.1.bz2 INDEX.2.bz2
 mv INDEX.0.bz2 INDEX.1.bz2
 bzip2 -c INDEX  INDEX.0.bz2
 #
 # get new INDEX
 #make index 21 | tee /var/log/build/make-index-`date
 +%Y%m%d-%H%M`.log portindex 21 | tee
 /var/log/build/make-index-`date +%Y%m%d-%H%M`.log #
 #fetch www.freebsd.org/ports/INDEX
 #chmod 644 INDEX
 portsdb -u

Excellent. Thanks so much for sending this, as this is just the sort of 
thing I need. I'll 

Re: crontab question involving cvsup

2004-08-26 Thread kstewart
On Thursday 26 August 2004 01:15 pm, Joshua Tinnin wrote:
 On Thursday 26 August 2004 02:28 am, kstewart [EMAIL PROTECTED] wrote:
  On Thursday 26 August 2004 01:09 am, Joshua Tinnin wrote:
   On Thursday 26 August 2004 12:42 am, epilogue
   [EMAIL PROTECTED]
  
   wrote:
On Thu, 26 Aug 2004 00:07:26 -0700
   
Joshua Tinnin [EMAIL PROTECTED] wrote:
 OK, I have searched the archives, and I can't find that my
 question has been answered previously, but please forgive me if
 that's incorrect.

 I'm using (or rather trying to use) cron to update my ports
 tree daily. I've tried several different combinations without
 success, and lately this is what I have in my crontab file:

snip
  cd /usr/ports
  #
  # make bzip2 backup and save 4 old ones for the days when make index
  # is broken
  #
  rm INDEX.3.bz2
  mv INDEX.2.bz2 INDEX.3.bz2
  mv INDEX.1.bz2 INDEX.2.bz2
  mv INDEX.0.bz2 INDEX.1.bz2
  bzip2 -c INDEX  INDEX.0.bz2
  #
  # get new INDEX
  #make index 21 | tee /var/log/build/make-index-`date
  +%Y%m%d-%H%M`.log portindex 21 | tee
  /var/log/build/make-index-`date +%Y%m%d-%H%M`.log #
  #fetch www.freebsd.org/ports/INDEX
  #chmod 644 INDEX
  portsdb -u

 Excellent. Thanks so much for sending this, as this is just the sort of
 thing I need. I'll work on it a bit tonight to customize it for my
 system. I'm glad you posted this, as in searching the archives I
 noticed you've posted it before, but it's changed since the last time.


After I sent it, I noticed that in the past I had used fetch. I would now use 
make fetchindex instead. With fetchindex, you don't have to modify the 
permissions on INDEX to use it as a user. 

When index builds are dying, it is a kind of moot point because I would resort 
to one of my backed up versions and not fetch from FreeBSD anyway. 

The output from a cron job can be pretty verbose at times and it all ends up 
as an email. I typically run uports at 4am and 4pm. My cvsup mirror is 
updated on the odd hours. Until I started using portindex, I used a job that 
just did the cvsup section and created the html. I would fetch a local copy 
of INDEX and INDEX.db from my test machine. That way only one machine spent 
the time creating INDEX. 

At this point, the test machine is using xorg-* and I have dropped my normal 
machine back to using XFree86. So, I have to create INDEX on both machines. 
There is a situation when xorg and KDE loses track of what keyboard and 
layout you are using. KDE switched into using some form of Greek. At least 
the letters appear to be from the Greek alphabet :).

Kent

-- 
Kent Stewart
Richland, WA

http://users.owt.com/kstewart/index.html
Support the Bison at http://www.buffalofieldcampaign.org/
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Ion-Mihai Tetcu
On Thu, 26 Aug 2004 13:48:19 -0700
kstewart [EMAIL PROTECTED] wrote:

 On Thursday 26 August 2004 01:15 pm, Joshua Tinnin wrote:
  On Thursday 26 August 2004 02:28 am, kstewart [EMAIL PROTECTED]
  wrote:
   On Thursday 26 August 2004 01:09 am, Joshua Tinnin wrote:
On Thursday 26 August 2004 12:42 am, epilogue
[EMAIL PROTECTED] wrote:
 On Thu, 26 Aug 2004 00:07:26 -0700
 Joshua Tinnin [EMAIL PROTECTED] wrote:

 snip

   cd /usr/ports
   #
   # make bzip2 backup and save 4 old ones for the days when make
   index# is broken
   #
   rm INDEX.3.bz2
   mv INDEX.2.bz2 INDEX.3.bz2
   mv INDEX.1.bz2 INDEX.2.bz2
   mv INDEX.0.bz2 INDEX.1.bz2
   bzip2 -c INDEX  INDEX.0.bz2
   #
   # get new INDEX
   #make index 21 | tee /var/log/build/make-index-`date
   +%Y%m%d-%H%M`.log portindex 21 | tee
   /var/log/build/make-index-`date +%Y%m%d-%H%M`.log #
   #fetch www.freebsd.org/ports/INDEX
   #chmod 644 INDEX
   portsdb -u

I'm using the same approach, although the script is different and (on
the master machine) it also parse the cvsup output for distinfo and
does a make fech and make checksum in the ports, plus saves the failed
fetch ports to retry to re-fetch them.

One thing you might want to add is -l flag to cvsup so if the cvsup
process fails (e.g. rejected by server: Access limit .. ) you don't end
up with 2 cvsup running in the same time.

[ ... ]

 The output from a cron job can be pretty verbose at times and it all
 ends up as an email. I typically run uports at 4am and 4pm. My cvsup
 mirror is updated on the odd hours. Until I started using portindex, I
 used a job that just did the cvsup section and created the html. I
 would fetch a local copy of INDEX and INDEX.db from my test machine.
 That way only one machine spent the time creating INDEX. 
 
 At this point, the test machine is using xorg-* and I have dropped my
 normal machine back to using XFree86. So, I have to create INDEX on
 both machines. There is a situation when xorg and KDE loses track of
 what keyboard and layout you are using. KDE switched into using some
 form of Greek. At least the letters appear to be from the Greek
 alphabet :).

I usually find it better to build index on all machines, since they have
different ports installed and *_DEPENDS may differ largely; this make
portversion happy.


-- 
IOnut
Unregistered ;) FreeBSD user

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question involving cvsup

2004-08-26 Thread Kevin D. Kinsey, DaleCo, S.P.
Joshua Tinnin wrote:
On Thursday 26 August 2004 08:28 am, Kevin D. Kinsey, DaleCo, S.P. 
[EMAIL PROTECTED] wrote:
 

Unlike the system crontab, user crontabs, including root's, are
under /var/cron; the file format is slightly different, and misuse
of the system crontab for regular jobs is the cause of several
FAQ posts we see here every few months or so; one of these goes
something like, why do I get an email from cron saying it can't
complete my job, unknown user, etc. ??
   

Again, I see nothing in the documentation warning against editing the 
system crontab file, only that it can't be installed/edited with the 
crontab command.

- jt
 

Well, you *can* do it that way ... but I wouldn't.  No flub up of mine
when running mergemaster is going to touch /var/cron/tabs/root;
OTOH, if I put my script calls in /etc/crontab ...
My point was that /etc/crontab is there for the machine, and
per-user crontabs are there for the users --- and that includes
root, so why not use it for what it's for?
Of course, one of the nice things about BSD, if you know
how and why, you can do it any way you like, almost...
H.A.N.D.,
KDK
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: crontab question

2004-02-19 Thread Derrick Ryalls
 Greetings,
 I am running 5.1-release.  I created the file 
 /var/cron/tabs/root .  It is owner root, group wheel. 
 permissions are -rw---
 
 I have the following entry in the file root
 
 0 22 2-31 * * /usr/local/bin/rsync -av /dept2/Marketing/ 
 /data/Marketing
 21 /r
 oot/rsync.log
 
 Of course the line above is all on one line.
 
 Well, this command did not run last night.  No 
 /root/rsync.log file was created. No email was generated.  Zip.
 
 what did I screw up to prevent cron from running the command ?
 

As far as I know, you should never manually create a crontab file.  Normal
users should just type crontab -e on a command line for scheduling.  The
same might apply to root, never tried personally.  One sure fire way to get
it working is to add your above line to /etc/crontab with root in the user
column.  This is not normally recommanded, so you might try doing crontab -e
as root first.

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question

2004-02-19 Thread Matt Emmerton
 Greetings,
 I am running 5.1-release.  I created the file
 /var/cron/tabs/root .  It is owner root, group wheel.
 permissions are -rw---

 I have the following entry in the file root

 0 22 2-31 * * /usr/local/bin/rsync -av /dept2/Marketing/ /data/Marketing
 21 /r
 oot/rsync.log

 Of course the line above is all on one line.

 Well, this command did not run last night.  No /root/rsync.log file was
 created.
 No email was generated.  Zip.

 what did I screw up to prevent cron from running the command ?

You did it by hand instead of using the more automated method.  Although you
got the ownership/permissions correct, I bet you didn't restart the cron
daemon (which is required so that it sees the newly created crontab.)

You should really use crontab -e to edit/create crontab files.  It will
look after ownership/permissions automatically, as well as kicking the cron
daemon.

--
Matt Emmreton

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Crontab question

2004-02-12 Thread Nathan Kinkade
On Thu, Feb 12, 2004 at 04:06:56PM -0600, Darryl Hoar wrote:
 Greetings,
 I am running 5.1-release.
 I have installed rsync from ports, and want to use it to archive.
 I want to add an entry to cron so it runs nightly.  I didn't quite
 understand the man page when it came to arguments to the 
 command you are running.
 
 ie
 0 0 1 * * *  /usr/local/bin/rsync -av /working/ /backup/working 
 
 I also want the output of the rsync command to go to a named file.
 
 Any help greatly appreciated.
 
 -Darryl

Without consideration to the syntax of rsync, a line much like the one
you have should work.  For example:

0 1 * * *  /usr/local/bin/rsync -av /dir /backup/dir 21 /root/rsync.log

This should run the specified command at 1AM every day of every week.

Nathan
-- 
gpg --keyserver pgp.mit.edu --recv-keys D8527E49


pgp0.pgp
Description: PGP signature


Re: crontab question...

2003-11-01 Thread Jean-Baptiste Quenot
* Xpression:

 Hi guys, I was  wondering if I have three script  files on crontab and
 all they are executed at the same hour how it's function ???

AFAICT, cron  forks a  new process  for each job  scheduled at  the same
time.

Cheers,
-- 
Jean-Baptiste Quenot
http://caraldi.com/jbq/
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: crontab question...

2003-11-01 Thread Sergey 'DoubleF' Zaharchenko
On Fri, 31 Oct 2003 13:16:29 -0500 Xpression [EMAIL PROTECTED] probably wrote:

 Hi guys, I was wondering if I have three script files on crontab and all
 they are executed at the same hour how it's function ??? I mean:
 
 #
 #minutehourmdaymonthwdaywhocommand
 #
 00***  root
 /path/one/script1
 00***  root
 /path/two/script2
 00***  root
 /path/three/script3
 
 they are executed at the same time or in order ??? thank

Generally, you shouldn't depend on that. If you want the scripts to be
executed in a particular order, write a wrapper script that says
something like

/path/one/script1
/path/two/script2
/path/three/script3

and add it to the crontab.

 ___
 [EMAIL PROTECTED] mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 


-- 
DoubleF
All men are mortal.  Socrates was mortal.  Therefore, all men are
Socrates.
-- Woody Allen


pgp0.pgp
Description: PGP signature


Re: crontab question...

2003-11-01 Thread Jack L. Stone
At 11:57 AM 11.1.2003 +0100, Jean-Baptiste Quenot wrote:
* Xpression:

 Hi guys, I was  wondering if I have three script  files on crontab and
 all they are executed at the same hour how it's function ???

AFAICT, cron  forks a  new process  for each job  scheduled at  the same
time.

Cheers,
-- 
Jean-Baptiste Quenot

Indeed, if you run several cron jobs at the same time and then look at ps
-ax you'll see several crons running. That's in addition to
/usr/sbin/cron which is loaded.

Best regards,
Jack L. Stone,
Administrator

Sage American
http://www.sage-american.com
[EMAIL PROTECTED]
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]