top | item 44140599

(no title)

jimis | 9 months 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.

discuss

order

sherburt3|9 months ago

Maybe 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|9 months ago

First, 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) ```

NeutralForest|9 months ago

Like the others said, you have to list them and save it somewhere, it could be better in that regard.

samtheprogram|9 months ago

I would try *.timer. If you’re in zsh, quote it.