Comments (1)
Your problem is essentially a common pitfall of shell scripts. The documentation says:
The command can be a string or a list of strings. If command is a string, yacron runs it through a shell, which is /bin/bash in the above example, but is /bin/sh by default.
If the command is a list of strings, the command is executed directly, without a shell.
The configuration
command: |
sleep 999
causes yacron to execute /bin/sh -c "sleep 999"
. That creates a tree of two processes:
/bin/sh
(parent)sleep 999
(child)
Then, when yacron tries to terminate the process, after timeout, it sends a signal to the parent process,/bin/sh
, which correctly terminates, but leaves childsleep 999
running, orphaned.
There are multiple ways to fix this issue.
Option 1: put an exec
.
command: |
exec sleep 999
In this case, yacron runs /bin/sh -c "exec sleep 999"
. But the exec
keyword causes the sleep command to replace the parent process, taking its place, so you no longer have parent and child, only parent.
Option 2: tell yacron not to run a shell at all, giving it a list of strings as command:
command:
- sleep
- "999"
This causes yacron to run /usr/bin/sleep 999
directly, no shell involved.
Option 3: modify the shell code to run to handle SIGTERM:
command: |
sleep 999 &
mysleep=$!
trap "kill $mysleep" TERM
wait $mysleep
from yacron.
Related Issues (20)
- LD_LIBRARY_PATH env var is breaking curl commands to HTTPS url HOT 2
- correct way for curl command HOT 2
- /etc/yacron.d is missing HOT 4
- Feature Request: activate / deactivate Jobs HOT 3
- Handling of schedule-entries not clear enough documented HOT 4
- Building yacron pyinstaller on newer python version fail HOT 3
- Propose: permanent tasks HOT 2
- Rollbar Support HOT 2
- A way to test schedules without running them HOT 3
- wish: timestamps for log outputs HOT 5
- Scheduled command failing when running with yacron HOT 1
- Great Jon HOT 1
- yacron not loading the .bashrc file at start HOT 1
- Specifying schedule outside YAML file HOT 1
- add support for smaller time units, like in Systemd timer or Monit HOT 2
- End of Support or End of Life dates for version 0.19
- cors HOT 3
- Fails to Send Email: login() got some positional-only arguments passed as keyword arguments: 'username, password' HOT 1
- Web startup message goes to stderr?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yacron.