mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-09 10:42:54 +01:00
create and move files if they dont exist for addtotab.sh - https://github.com/Security-Onion-Solutions/securityonion-saltstack/issues/749
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# This script adds sensors/nodes/etc to the nodes tab
|
# This script adds sensors/nodes/etc to the nodes tab
|
||||||
|
default_salt_dir=/opt/so/saltstack/default
|
||||||
local_salt_dir=/opt/so/saltstack/local
|
local_salt_dir=/opt/so/saltstack/local
|
||||||
TYPE=$1
|
TYPE=$1
|
||||||
NAME=$2
|
NAME=$2
|
||||||
@@ -14,6 +15,14 @@ MONINT=$9
|
|||||||
#NODETYPE=$10
|
#NODETYPE=$10
|
||||||
#HOTNAME=$11
|
#HOTNAME=$11
|
||||||
|
|
||||||
|
if [ ! -d $local_salt_dir/pillar/data/ ]; then
|
||||||
|
mkdir -p $local_salt_dir/pillar/data/
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f $local_salt_dir/pillar/data/$TYPE.sls ]; then
|
||||||
|
cp $default_salt_dir/pillar/data/$TYPE.sls $local_salt_dir/pillar/data/$TYPE.sls
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Seeing if this host is already in here. If so delete it"
|
echo "Seeing if this host is already in here. If so delete it"
|
||||||
if grep -q $NAME "$local_salt_dir/pillar/data/$TYPE.sls"; then
|
if grep -q $NAME "$local_salt_dir/pillar/data/$TYPE.sls"; then
|
||||||
echo "Node Already Present - Let's re-add it"
|
echo "Node Already Present - Let's re-add it"
|
||||||
|
|||||||
Reference in New Issue
Block a user