aboutsummaryrefslogtreecommitdiff
path: root/articles/2026/Living-on-Snac's-bleeding-edge.html
blob: a17ffc6ac3e157b39dea431baf5c64fd69c5053e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<!doctype html>
<html lang="en">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="/style.css" />
    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
    <title>Living on Snac's bleeding edge</title>
  </head>
  <body>
    <header>
      <h1>Bloggings</h1>
      <a href="/index.php">Back</a>
    </header>
    <main>
      <article>
        <h2>Living on Snac's bleeding edge</h2>
        <h3>2026-05-25</h3>
        <h4>Autoupdate script</h4>
        <p>
          I like living on the bleeding edge of
          <a href="https://codeberg.org/grunfink/snac2">snac2</a>, so I added
          this (banal) script to /etc/cron.daily.
        </p>
        <pre>
#!/usr/bin/env bash
# snaceto
# Social Networks Are Crap Except This One

cd /home/snac/src/snac2 || exit

sudo -u snac git remote update
UPDATED="$(git status -uno | grep -c 'up to date')"

if [ "$UPDATED" -ne "1" ] ; then
    echo "Updating..."
    systemctl stop snac.service
	# backup data before update
	TODAY=$(date "+%Y-%m-%d-%H-%m")
	BACKUPDIR="/opt/backups"
	mkdir -p "$BACKUPDIR"
	FILENAME="$BACKUPDIR/pre-update-snac-$TODAY.tar.gz"
	tar -zcf "$FILENAME" /home/snac/data
	# pull latest
	sudo -u snac git pull
	sudo -u snac make
	make install
	sudo -u snac snac upgrade /home/snac/data
	systemctl start snac.service
	VERSION="$(snac | head -n2)"
	toot post "My bleeding edge #snac2 server has been updated<br>$VERSION"
fi
</pre>
      </article>
    </main>
    <footer>
      <p>§</p>
    </footer>
  </body>
</html>