News for hackers. Stuff that matters.
Re:An almost perfect rsync over SSH backup script by darrenf on Friday February 25, 2022 @09:33AM (#30467679)
Can't help but throw a couple cents/pennies around whenever an "almost perfect" or "advanced" script makes my knee jerk so wildly. So here goes. For this part:

    pro_on=$(ps aux | grep -c rsync)

    # if someone is using rsync
    # grep is also producing one entry so -gt 1
`grep` can be excluded from the output by putting square brackets around one character of the search pattern, like so:

    pro_on=$(ps aux | grep -c rsyn[c])
Also, this:

    minutes=$(($minutes - 1))
Can be more easily written as:

    ((minutes--))
Re:An almost perfect rsync over SSH backup script by joosters on Friday February 25, 2022 @09:45AM (#30467792)
> `grep` can be excluded from the output by putting square brackets around one character of the search pattern

That's a great trick, thanks! I'm so used to adding '| grep -v grep' at the end of a 'ps | grep' command, your way is much nicer.

Re:An almost perfect rsync over SSH backup script by Symbiote on Friday February 25, 2022 @09:51AM (#30467848)
On Linux, pgrep is probably what you need most of the time, or pkill.
Re:An almost perfect rsync over SSH backup script by varenc on Friday February 25, 2022 @07:42PM (#30474240)
I like the `psgrep` tool which behaves much more like greping ps that pgrep does. And `psgrep` is actually just a bash script itself.
Re:An almost perfect rsync over SSH backup script by uhradone on Monday March 07, 2022 @07:16AM (#30586847)
THX the "almost" is getting closer to "almost"!