clmbmb

joined 2 years ago
[–] clmbmb@lemmy.dbzer0.com -1 points 1 year ago (2 children)

You have no idea what that would do in Linux. First read some documentation, then decide if you really need it. I guess you can see by the number of people trying to put you on the right path that what you want is not a good idea.

[–] clmbmb@lemmy.dbzer0.com 2 points 1 year ago

Yes, for sure. Timers are more versatile than what cron jobs can do.

[–] clmbmb@lemmy.dbzer0.com 3 points 1 year ago (1 children)

I can't see anywhere that a [Timer] section can be added to a service unit. I tried it and it doesn't work:

Apr 11 13:16:15 computer systemd[2593025]: /home/clmbmb/.config/systemd/user/test.service:10: Unknown section 'Timer'. Ignoring.

The service/script ran as it should, but the Timer section is ignored, as you can see.

[–] clmbmb@lemmy.dbzer0.com 1 points 1 year ago

Thanks for the suggestion. I'll look into this too.

[–] clmbmb@lemmy.dbzer0.com 7 points 1 year ago (2 children)

I don't think so, but I wanted to try systemd timers.

[–] clmbmb@lemmy.dbzer0.com 4 points 1 year ago

I just read a bit some internet posts and the documentation. I set TimeoutSec=infinity inside the service and I set the timer to run it now. I'll see if that helps.

[–] clmbmb@lemmy.dbzer0.com 4 points 1 year ago

Just in case, you are sure that you didn’t just accidentially kill or killall rclone or bash?

No. The process runs at night. Only if my dog started learning Linux and tested something! That makes me wonder...

[–] clmbmb@lemmy.dbzer0.com 5 points 1 year ago (2 children)

No, my script doesn't fork and I don't think rclone does that either.

Here's the script (pretty simple):

#!/bin/bash

repos=(fotorepo multirepo persorepo appconfigs)

if pidof -x rclone >/dev/null; then
  echo "Process already running"
  exit 1
fi

for repo in "${repos[@]}"; do
    inidate=$(date +'%Y%m%d_%H%M%S')
    /usr/bin/rclone -v --log-file=/backup/borg/logs/${repo}_b2sync_${inidate}.log sync /backup/borg/${repo} b2:${repo}
    if [[ $? -eq 0 ]]; then
      MSGDATE=$(date +'%d/%m/%y %T')
      mesaj="[${MSGDATE}] Upload for ${repo} was successful."
      curl -H "Title: B2 Upload" -H "Tags: arrow_double_up" -d "${mesaj}" "${URL}"
      #sendmsg "[${MSGDATE}] Upload for <b>${repo}</b> was <b><u>successful</u></b>."
    else
      MSGDATE=$(date +'%d/%m/%y %T')
      mesaj="[${MSGDATE}] Upload for ${repo} has failed. Check the logs."
      curl -H "Title: B2 Upload" -H "Tags: warning" -H "prio:high" -d "${mesaj}" "${URL}"
      #sendmsg "[${MSGDATE}] Upload for <b>${repo}</b> has <b><u>failed</u></b>. Check the logs."
    fi
    enddate=$(date +'%Y%m%d_%H%M%S')
    mv /backup/borg/logs/${repo}_b2sync_${inidate}.log /backup/borg/logs/${repo}_b2sync_${enddate}.log
done
[–] clmbmb@lemmy.dbzer0.com 4 points 1 year ago (7 children)
[Unit]
Description=Run rclone up for b2

[Service]
Type=oneshot
ExecStart=/zet/Users/radu/backup/rclone_up.sh

[Install]
WantedBy=rclone-up.timer
[–] clmbmb@lemmy.dbzer0.com 20 points 1 year ago (1 children)

TLDW: read all the blog posts, all the discussions and make your own opinion. I lost 15 minutes of my life and didn't become any more informed or smarter.

[–] clmbmb@lemmy.dbzer0.com 15 points 1 year ago* (last edited 1 year ago) (2 children)

Start a self-hosted server. You're welcome to join !selfhost@lemmy.ml or !selfhosted@lemmy.world.

view more: ‹ prev next ›