Open zishiguo opened 2 years ago
I found a solution. I use shell script instead of command inside the docker-compose.yml
version: "3"
services:
...
rpa_db:
image: mysql:5.7
container_name: rpa_db
restart: always
labels:
...
ofelia.job-exec.jobs-clean.command: "./root/jobs_clean.sh"
volumes:
- ./db/jobs_clean.sh:/root/jobs_clean.sh
networks:
rpa:
driver: bridge
jobs_clean.sh
as follows:
#!/bin/sh
echo 'delete from jobs where startTime > 0 and unix_timestamp()-startTime > 30 * 24 * 3600 limit 1;' | mysql -u root -prpa rpa_db
My english is poor,
docker-compose.yml
, as follows:clean.sql
as follows:20220324_013352_jobs-clean.json
as follows:20220324_013352_jobs-clean.stderr.log
as follows:20220324_013352_jobs-clean.stdout.log
as follows:I execute
mysql -u root -prpa rpa_db \u003c /root/clean.sql
as literal inrpa_db
container, got the same stdout.I guess that the less-than sign is escaped for the reason. I hope you should understand my description.