4 ms·
What is the systemd equivalent for `service crond stop` and later `service crond start`? In other words, I want to disable all jobs for some time (for benchmar
by jimis 1y ago
What is the systemd equivalent for `service crond stop` and later `service crond start`?
In other words, I want to disable all jobs for some time (for benchmarking) and then bring them back up.
- sherburt3 1y agoMaybe you could make a target unit file like “jobs.target” and in your timer unit files do “WantedBy=jobs.target”. Then you could do “systemctl start/stop jobs.target”
- r2_pilot 1y agoFirst, list and save the currently active timers: ```bash systemctl list-timers --state=active --no-legend | awk '{print $NF}' > /tmp/active_timers.txt ``` Stop all active timers: ```bash sudo systemctl stop $(cat /tmp/active_timers.txt) ``` Later, restart the previously active timers: ```bash sudo systemctl start $(cat /tmp/active_timers.txt) ```
- samtheprogram 1y agoI would try *.timer. If you’re in zsh, quote it.
- NeutralForest 1y agoLike the others said, you have to list them and save it somewhere, it could be better in that regard.