-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate.sh
More file actions
executable file
·38 lines (29 loc) · 1.05 KB
/
update.sh
File metadata and controls
executable file
·38 lines (29 loc) · 1.05 KB
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
#!/bin/bash
# Ensure up to date
git pull || exit $?
# If bin folder does not exist, make it
if [[ ! -d ~/.local/bin ]]; then
mkdir -p ~/.local/bin || exit $?
fi
# If systemd config folder does not exist, make it
if [[ ! -d ~/.config/systemd/user ]]; then
mkdir -p ~/.config/systemd/user || exit $?
fi
# Stop services
systemctl --user stop http-bash-requests.timer
systemctl --user stop http-bash-requests.service
# If timer does not exist, copy it
if [[ ! -f ~/.config/systemd/user/http-bash-requests.timer ]]; then
cp http-bash-requests.timer ~/.config/systemd/user/http-bash-requests.timer || exit $?
fi
# If service does not exist, copy it
if [[ ! -f ~/.config/systemd/user/http-bash-requests.service ]]; then
cp http-bash-requests.service ~/.config/systemd/user/http-bash-requests.service || exit $?
fi
# Re-build
go build -o ~/.local/bin/http-bash-requests .
# Reload daemon and start service again
systemctl --user daemon-reload
systemctl --user enable --now http-bash-requests.timer
# Get status
systemctl --user status http-bash-requests.service