[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
This commit was merged in pull request #4.
This commit is contained in:
25
scripts/jumpserver_deploy.sh
Normal file → Executable file
25
scripts/jumpserver_deploy.sh
Normal file → Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -ex
|
||||
THIS_DIR=$( cd "$( dirname "${BASH_SOURCE[0]:-${(%):-%x}}" )" && pwd )
|
||||
|
||||
adduser \
|
||||
--disabled-password \
|
||||
--home /home/ssh \
|
||||
--gecos "jumpserver user ssh" \
|
||||
ssh
|
||||
|
||||
usermod -p '*' ssh
|
||||
|
||||
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/crontabs/root" "*/5 * * * * cd \"$THIS_DIR\" && git pull && \"$THIS_DIR\"/jumpserver_cron.sh"
|
||||
|
||||
"$THIS_DIR"/jumpserver_cron.sh
|
||||
|
||||
Reference in New Issue
Block a user