rc

Fix transfer bug with rsync

There was a problem where using rsync to synchronize my directories didn't work. This was because I reinstalled my server, but didn't install rsync. Normally this would throw an error, but I muted the output of rsync with &> /dev/null.
A warning was added, and the muting of the output has been removed in both .zlogin and shutdown.sh.

Author
Maarten 'Vngngdn' Vangeneugden
Date
Oct. 1, 2017, 5:03 p.m.
Hash
d2cf11c09b6c88cb60dbe8977495c1a0849bfb8c
Parent
3cfe1f19aa004b735994c4019f76fb5e0d40a1dc
Modified files
.zlogin
shutdown.sh

.zlogin

1 addition and 1 deletion.

View changes Hide changes
1
1
2
2
# First, boot the GNU Emacs daemon. This usually takes a relatively long time,
3
3
# allowing the computer to establish an internet connection in the meantime, so
4
4
# it can synchronize the directories and pull changes in repositories.
5
5
echo -e "Booting GNU Emacs...\n"
6
6
emacs --daemon=gnuemacs
7
7
echo -e "GNU Emacs booted as 'gnuemacs' daemon.\n"
8
8
9
9
# by pulling all changes in the repositories:
10
10
echo -e "Updating all repositories...\n"
11
11
cd ~/Repositories
12
12
for directory in */ ; do
13
13
	cd $directory
14
14
	git pull
15
15
	cd ..  # Returning to Repositories
16
16
done
17
17
18
18
cd ~  # Return to home
19
19
20
20
echo -e "Synchronizing remaining university data...\n"
21
21
rsync -a -P --delete -e ssh maarten@maartenv.be:/home/maarten/Documenten/University ~ &> /dev/null
22
-
+
22
23
23
echo -e "All tasks completed. Initializing i3 boot process... OwO"
24
24
# Start X
25
25
if [ -z "$DISPLAY" ] && [ -n "$XDG_VTNR" ] && [ "$XDG_VTNR" -eq 1 ]; then
26
26
  exec startx
27
27
fi

shutdown.sh

3 additions and 2 deletions.

View changes Hide changes
1
1
# whether the repositories are handled properly, and aborts if there is still
2
2
# work to be done. Of course, it can be overridden anytime by manually issuing
3
3
# the shutdown command.
4
4
# This script is made to work with i3, because it uses the i3-nagbar to send
5
5
# messages to the user.
6
6
7
7
readyForShutdown=true
8
8
9
9
echo -e "Checking all repositories for outstanding commits...\n"
10
10
cd ~/Repositories
11
11
for directory in */ ; do
12
12
	cd $directory
13
13
    echo -e "Checking $directory...\n"
14
14
    files="$(git status -s)"
15
15
    if [ "${files:0:2}" == " M" ]; then
16
16
        i3-nagbar -t warning -m "Repository $directory has uncommitted modifications!"
17
17
        readyForShutdown=false
18
18
        break
19
19
    else
20
20
        git push # Pushing the changes to the upstream repo if applicable
21
21
    fi
22
22
	cd ..  # Returning to Repositories
23
23
done
24
24
25
25
cd ~  # Return to home
26
26
27
27
if [ "$readyForShutdown" == true ]; then
28
28
    echo -e "Synchronizing remaining university data...\n"
29
29
    rsync -a -P --delete -e ssh ~/University maarten@maartenv.be:/home/maarten/Documenten &> /dev/null
30
-
fi
+
30
    # XXX: The receiving server must also have rsync installed!
+
31
fi
31
32
32
33
33
34
34
35
if [ "$readyForShutdown" == true ]; then
35
36
    # All set!
36
37
    echo -e "All tasks completed, system will now terminate. Have a furry day. =3\n"
37
38
    sleep 1  # Necessary to let the nice furry pun display long enough OwO
38
39
#   shutdown now
39
-
fi
+
40
fi
40
41