2022年8月23日 星期二

alpine nginx logrote with supervisord

ls -alh /var/lib/logrotate.status

   8 cat /var/lib/logrotate.status

   9 history

  10 logrotate -v /etc/logrotate.d/nginx

  11 history

  12 logrotate -vdf /etc/logrotate.conf

  13 ls -al /var/log/nginx/

  14 logrotate -vdf /etc/logrotate.conf


https://blog.toright.com/posts/4622/nginx-log-%E4%BB%A5%E6%97%A5%E6%9C%9F%E6%AD%B8%E6%AA%94.html

https://jiaming0708.github.io/2021/01/26/logrotate-nginx/

 


log does not need rotating (log has already been rotated)

###########################

# good at logrotate

###########################

https://www.baeldung.com/linux/rotating-logs-logrotate

https://www.onitroad.com/jc/linux/how-to-install-and-configure-log-roate-in-alpine-linux.html

https://weinan.io/2019/04/06/cron.html


##############

# crond

###############

https://asaba.sakuragawa.moe/2018/10/%E5%9C%A8-alpine-linux-%E5%AE%B9%E5%99%A8%E4%B8%AD%E4%BD%BF%E7%94%A8-crontab/

https://askubuntu.com/questions/907388/start-cron-service-with-supervisor


###############################

 supervisdrd

###################################

https://stackoverflow.com/questions/49090469/docker-alpine-linux-running-2-programs

https://www.huweihuang.com/article/linux/supervisor-usage/


1. Dockerfile is:

FROM alpine:latest
RUN apk update && apk add --no-cache supervisor openssh nginx
COPY supervisord.conf /etc/supervisord.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]

2. supervisord.conf is:


[supervisord]

nodaemon=true


[program:crond]

command=/usr/sbin/crond -f


[program:nginx]

command=nginx -g 'daemon off;'




##

var/www # crond --help

BusyBox v1.28.4 (2018-07-17 15:21:40 UTC) multi-call binary.


Usage: crond -fbS -l N -d N -L LOGFILE -c DIR


    -f  Foreground

    -b  Background (default)

    -S  Log to syslog (default)

    -l N    Set log level. Most verbose:0, default:8

    -d N    Set log level, log to stderr

    -L FILE Log to FILE

    -c DIR  Cron dir. Default:/var/spool/cron/cro



#######################

 for reference

#####################

https://stackoverflow.com/questions/43792897/supervisorctl-3-3-1-not-working-complaining-about-not-finding-conf-file

https://askubuntu.com/questions/911940/error-ini-file-does-not-include-supervisorctl-section


沒有留言:

張貼留言