init
This commit is contained in:
40
update-code-server.sh
Normal file
40
update-code-server.sh
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
is_running() {
|
||||
# check if running
|
||||
me="$(basename "$0")";
|
||||
result=$(ps aux | grep -i $me | grep -v "grep" | wc -l)
|
||||
echo "running: $result"
|
||||
if [ $result -gt 4 ]
|
||||
then
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
is_root() {
|
||||
if [[ $(id -u) -ne 0 ]]
|
||||
then echo "Please run as root"
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
main_function() {
|
||||
is_running
|
||||
is_root
|
||||
|
||||
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin"
|
||||
|
||||
#curl -fsSL https://code-server.dev/install.sh | sh -s -- --dry-run # dry-run
|
||||
curl -fsSL https://code-server.dev/install.sh | sh # install
|
||||
|
||||
#systemctl disable code-server@root # disable automatically created service
|
||||
|
||||
systemctl restart code-server
|
||||
}
|
||||
|
||||
ROOTDIR=/home/zino/projects/update-code-server
|
||||
STATUSFILE=$ROOTDIR/logs/$(date +"%Y-%m-%d-%H-%M-%S").log
|
||||
echo "$STATUSFILE"
|
||||
|
||||
# log everything, but also output to stdout
|
||||
main_function 2>&1 | tee -a "$STATUSFILE"
|
||||
Reference in New Issue
Block a user