Both files needs to be added to:
/etc/systemd/system/
To start the timer:
systemd can run specific tasks at specific times or events. You need to create 2 unit files:
$ sudo nano /etc/systemd/system/craft-queue.service
And add the service attached to this gist, adapting the ExecStart path to match the one on your server.
| #!groovy | |
| pipeline { | |
| agent { | |
| docker { | |
| image 'jenkinsslave:latest' | |
| registryUrl 'http://XXXXXXX.dkr.ecr.us-west-2.amazonaws.com' | |
| registryCredentialsId 'ecr:us-east-1:1111111-1111111-11111-1111' | |
| args '-v /home/centos/.ivy2:/home/jenkins/.ivy2:rw -v jenkins_opt:/usr/local/bin/opt -v jenkins_apijenkins:/home/jenkins/config -v jenkins_logs:/var/logs -v jenkins_awsconfig:/home/jenkins/.aws --privileged=true -u jenkins:jenkins' | |
| } | |
| } |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |