https://nebula-graph.io logo
#nebula
Title
# nebula
p

porsche

12/27/2022, 1:53 AM
Did anyone try log clean up using Cronjob? Can I get code snippet please?
w

wey

12/27/2022, 2:01 AM
Try something like this
Copy code
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: log-cleanup
spec:
  schedule: "0 0 * * *"  # run the job every day at midnight
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: log-cleanup
            image: your-log-cleanup-image:latest
            command: ["/bin/sh", "-c", "./cleanup.sh /path/to/log"]
          restartPolicy: OnFailure
p

porsche

12/27/2022, 2:29 AM
where is cleanup.sh?
w

wey

12/27/2022, 2:51 AM
it’s just an example, we could write our own as our needs, i.e. moving it to some colders storage for further usage, or simply removing them.
p

porsche

12/27/2022, 3:08 AM
Do you have sample code snippet for script for that as well?
6 Views