1
0
forked from NASP/registry
registry/scripts/testbed_deploy.sh
DictXiong 8bc58f889c [dev] first working version (#4)
works fine for one month

Co-authored-by: Dict Xiong <me@beardic.cn>
Co-authored-by: xiongdian.me <xiongdian.me@bytedance.com>
Co-authored-by: xiuting.xu <xuxiuting04@126.com>
Co-authored-by: lintaothu <lintaothu@163.com>
Co-authored-by: toghrul <tabbasli@hotmail.com>
Co-authored-by: baiyu <baiyu@zgclab.edu.cn>
Reviewed-on: https://git.nasp.ob.ac.cn/NASP/registry/pulls/4
2023-05-30 13:21:29 +08:00

21 lines
471 B
Bash
Executable File

#!/bin/bash
set -ex
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
apt update && apt install sudo
addgroup nasp
insert_if_not_exist()
{
filename=$1
line=$2
if [ ! -f "$filename" ]; then
touch $filename
fi
grep -qxF -- "$line" "$filename" || echo "$line" >> "$filename"
}
insert_if_not_exist "/etc/crontab" "*/5 * * * * root cd \"$THIS_DIR\" && git pull && \"$THIS_DIR\"/testbed_cron.sh"
"$THIS_DIR"/testbed_cron.sh