New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 82674


Ignore:
Timestamp:
08/17/11 15:54:28 (4 years ago)
Author:
pixilla@…
Message:

users/pixilla:

  • Add notes
  • Add conf example
  • Add startupitem example
  • Add startupitem variant
File:
1 edited

Legend:

Unmodified
Added
Removed
  • users/pixilla/dports/sysutils/logrotate/Portfile

    r82307 r82674  
    77version             3.8.0 
    88categories          sysutils 
    9 maintainers         markd openmaintainer 
     9maintainers         pixilla openmaintainer 
    1010platforms           darwin 
    1111 
     
    5454                    ${destroot}${prefix}/var/run/logrotate 
    5555post-destroot { 
    56     xinstall -m 755 ${worksrcpath}/examples/logrotate-default \ 
    57         ${destroot}${prefix}/etc/logrotate.conf.sample 
     56    xinstall -d ${destroot}${prefix}/share/${name} 
     57    set fp [open ${destroot}${prefix}/share/${name}/logrotate.conf.example w] 
     58    puts $fp \ 
     59"# see \"man logrotate\" for details 
     60# rotate log files weekly 
     61weekly 
     62 
     63# keep 4 weeks worth of backlogs 
     64rotate 4 
     65 
     66# create new (empty) log files after rotating old ones 
     67create 
     68 
     69# use date as a suffix of the rotated file 
     70dateext 
     71 
     72# uncomment this if you want your log files compressed 
     73#compress 
     74 
     75# Drop log rotation information into this directory 
     76include ${prefix}/etc/logrotate.d" 
     77    close $fp 
     78 
     79    set fp [open ${destroot}${prefix}/share/${name}/org.macports.logrotate.plist.example w] 
     80    puts $fp \ 
     81"<?xml version=\"1.0\" encoding=\"UTF-8\"?> 
     82<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"> 
     83<plist version=\"1.0\"> 
     84<dict> 
     85        <key>Disabled</key> 
     86        <true/> 
     87        <key>Label</key> 
     88        <string>com.pixilla.logrotate</string> 
     89        <key>ProgramArguments</key> 
     90        <array> 
     91                <string>${prefix}/sbin/logrotate</string> 
     92                <string>${prefix}/etc/logrotate.conf</string> 
     93        </array> 
     94        <key>StartCalendarInterval</key> 
     95        <dict> 
     96                <key>Hour</key> 
     97                <integer>5</integer> 
     98                <key>Minute</key> 
     99                <integer>30</integer> 
     100        </dict> 
     101</dict> 
     102</plist>" 
     103    close $fp 
     104    if {[variant_isset startupitem]} { 
     105        xinstall -d ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate 
     106        xinstall -d ${destroot}/Library/LaunchDaemons 
     107        xinstall -m 755 ${destroot}${prefix}/share/${name}/org.macports.logrotate.plist.example \ 
     108            ${destroot}${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist 
     109        ln -sf "${prefix}/etc/LaunchDaemons/org.macports.logrotate/org.macports.logrotate.plist" "${destroot}/Library/LaunchDaemons/org.macports.logrotate.plist" 
     110    } 
    58111} 
    59112 
     
    76129} 
    77130 
    78 if {![variant_isset gzip]} { 
    79     default_variants +bzip2 
    80     variant_set bzip2 
     131variant startupitem description {Install launchd plist} { 
     132} 
     133 
     134default_variants    +startupitem 
     135 
     136if {![variant_isset bzip2]} { 
     137    default_variants-append \ 
     138                    +gzip 
     139    variant_set     gzip 
    81140} 
    82141 
     
    86145 
    87146notes \ 
    88 "Copy ${prefix}/etc/logrotate.conf.sample to ${prefix}/etc/logrotate.conf for a start: 
    89 \$ cp ${prefix}/etc/logrotate.conf.sample ${prefix}/etc/logrotate.conf 
    90 Afterwards putting logrotate scripts in ${prefix}/etc/logrotate.d will cause them to  
    91 be executed with the following command: 
    92 \$ ${prefix}/bin/${name} ${prefix}/etc/logrotate.conf" 
     147" 
     148 
     149To use logrotate: 
     150 
     151  * If ${prefix}/etc/logrotate.conf does not exist copy the example into place. 
     152 
     153    \$ sudo cp ${prefix}/share/${name}/logrotate.conf.example ${prefix}/etc/logrotate.conf 
     154 
     155  * logrotate scripts added to ${prefix}/etc/logrotate.d will read by default 
     156 
     157    \$ sudo ${prefix}/sbin/${name} ${prefix}/etc/logrotate.conf 
     158 
     159  * With the +startupitem variant you can activate a scheduled log rotation with this command. 
     160 
     161    \$ sudo port load Logrotate 
     162 
     163  * To create your own startup item with non-default intervals build; without the +startupitem 
     164    variant, copy the example into place and manually edit to your liking. 
     165 
     166    \$ sudo cp ${prefix}/share/${name}/org.macports.logrotate.plist.example\ 
     167/Library/LaunchDaemons/org.macports.logrotate.plist 
     168 
     169    Once your /Library/LaunchDaemons/org.macports.logrotate.plist file is ready maunually load it 
     170    with this command. 
     171 
     172    \$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.logrotate.plist 
     173     
     174" 
Note: See TracChangeset for help on using the changeset viewer.