registry/scripts/testbed_deploy.sh

21 lines
471 B
Bash
Raw Normal View History

2023-04-21 17:12:36 +08:00
#!/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"
}
2023-04-21 17:36:01 +08:00
insert_if_not_exist "/etc/crontab" "*/5 * * * * root cd \"$THIS_DIR\" && git pull && \"$THIS_DIR\"/testbed_cron.sh"
2023-04-21 17:12:36 +08:00
2023-04-21 17:23:04 +08:00
"$THIS_DIR"/testbed_cron.sh