Search
Searches topics and replies. Every word has to appear in the post.
20 posts found.
| Post | Posted |
|---|---|
Reviving to say I moved one of my boxes to timers after this thread and then moved it back when I realised I'd forgotten how to read the journal on a read-only rescue boot. journalctl -D /mnt/var/log/journal for next time. | by oldpc |
That was it. Cron started in my home directory, so ./readings.db was a brand new empty database. Absolute paths and a cd at the top of the script. Marking resolved. | by dan_r |
Use absolute paths for the database and output file. Also redirect stderr to a log so you can see if sqlite is opening a different database. | by Anonymous |
Trying to dump a small sqlite database from cron. Running the script in a terminal works, but the nightly output is a zero-byte file. The crontab line is: 15 2 * * * /home/me/bin/export-readings.sh The script uses ./readings.db. Does cron s… | by dan_r |
On points perhaps. My timers are still running. | by dan_r |
I'll take it. Thread closed, I win. | by sysv |
OnFailure= pointing to a unit that sends a mail. You have to write that unit. I'll give you that one, cron wins on this. | by dan_r |
Fine. One real point: cron mails me on failure and it's built in. What do you do with a timer? | by sysv |
user timers need loginctl enable-linger or they stop when you log out. that one cost me a week of missing backups | by Anonymous |
Cron's environment has caught me more than anything else on this list. PATH with nothing in it, wrong cwd. A service unit can have the same issue but at least you can test it with systemctl start and get the same environment as the real run… | by kettle |
The log file can. | by sysv |
For the record here's what the whole thing actually is: # backup.service [Service] Type=oneshot ExecStart=/usr/local/bin/backup.sh # backup.timer [Timer] OnCalendar=--* 02:15:00 Persistent=true RandomizedDelaySec=300 [Install] WantedBy=time… | by nils !PxNS1ZCy |
Timers still need a service file, a timer file and a daemon-reload to do what one line did. I'm with sysv. Grudgingly, since I don't agree with him about anything else. | by vek |
No. I found out about flock when four rsyncs were running at once. | by sysv |
And you remember it every time? Honest question. | by dan_r |
flock -n /tmp/x.lock cmd. Eleven characters plus a filename. | by sysv |
The other one for me is overlap. A timer won't start the service again while it's still running. With cron a slow job stacks up unless you remember to wrap it in flock. | by oldpc |
So install anacron. | by sysv |
I had the same view until a sensor box was off for a night and missed its backup. Persistent=true runs the missed job at next boot. With cron you need anacron for that. | by dan_r |
Every six months somebody tells me to move my jobs to timers. So: two files instead of one line, and a unit name I now have to think of, so that I can read the output through journalctl instead of a plain file. What exactly do I get? I've b… | by sysv |