Hi,

On 28 Dec 2012, at 3:07pm, Peng Yu <pengyu...@gmail.com> wrote:

> Hi,
> 
> I have the following crontab entry.
> 
> ~$ sudo crontab -l
> Password:
> * 1 * * * bash -c "/opt/local/bin/port selfupdate; /opt/local/bin/port
> upgrade outdated" 1>/tmp/portupdate_out.log 2>/tmp/portupdate_err.log

That will run the script once every *minute* during the hour of 1am, due to the 
wildcard on the minute. I presume that is not what you want. 

To run it once a day, you give a particular hour *and* minute. Say

0 1 * * * ….

to run the script once a day, at 1am.

> 
> But it seems not working properly, as I always get an error like the
> following after the scheduled time of the crontab entry.
> 
> ~$ sudo port upgrade tk
> Waiting for lock on /opt/local/var/macports/registry/.registry.lock

Almost certainly due to the above, where you run the script once every minute…

> 
> I also notice that launchd succeed crontab on mac OS X. So it might be
> better to avoid launchd.
> 
> Does anybody have some example on how to setup up "port selfupdate"
> and "port upgrade outdated" run periodically (say once a day)? Thanks!

Note that currently not all ports build properly in a root crontab, due to

https://trac.macports.org/ticket/34221

I stopped trying to do this, because of this. A workaround does exist, which is 
to run crontab as a regular user, but setup sudo so that user can run 'sudo 
port' without needing to enter a password. I haven't bothered to try this 
myself.

  cheers Chris

> -- 
> Regards,
> Peng
> _______________________________________________
> macports-users mailing list
> macports-users@lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo/macports-users

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
macports-users mailing list
macports-users@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo/macports-users

Reply via email to