I have to pause rsnapshot from running some backups some times, so I created a lockfile for this time:
cat > /var/run/rsnapshot/rsnapshot.pid << EOF
$$
EOF
sleep 120s
But rsnapshot tells me "removing stale lockfile" and goes on with its backup.
What do I have to do that the lockfile isn´t stale for rsnapshot ?
The man tells this:
If a lockfile exists when rsnapshot starts, it will try to read the file and stop with an error if it can't. If it can read the file, it sees if a process exists with the PID noted in the file. If it does, rsnapshot stops with an error message. If there is no process with that PID, then we assume that the lockfile is stale and ignore it unless stop_on_stale_lockfile is set to 1 in which case we stop.
That would mean, it shouldn´t be stale as long as the bashscript runs. But it doesn´t work this way.
Edit:
Damn, I found the problem, there is a problem if the lockfile is owned by another user than rsnapshot runs from...