mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 09:12:45 +01:00
Require at least on arg for start/stop/restart scripts
This commit is contained in:
@@ -19,18 +19,22 @@
|
|||||||
|
|
||||||
. /usr/sbin/so-common
|
. /usr/sbin/so-common
|
||||||
|
|
||||||
echo $banner
|
if [ $# -ge 1 ]; then
|
||||||
printf "Restarting $1...\n\nThis could take a while if another Salt job is running. \nRun this command with --force to stop all Salt jobs before proceeding.\n"
|
|
||||||
echo $banner
|
|
||||||
|
|
||||||
if [ "$2" = "--force" ]
|
echo $banner
|
||||||
then
|
printf "Restarting $1...\n\nThis could take a while if another Salt job is running. \nRun this command with --force to stop all Salt jobs before proceeding.\n"
|
||||||
printf "\nForce-stopping all Salt jobs before proceeding\n\n"
|
echo $banner
|
||||||
salt-call saltutil.kill_all_jobs
|
|
||||||
|
if [ "$2" = "--force" ]; then
|
||||||
|
printf "\nForce-stopping all Salt jobs before proceeding\n\n"
|
||||||
|
salt-call saltutil.kill_all_jobs
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
"cortex") docker stop so-thehive-cortex so-thehive && docker rm so-thehive-cortex so-thehive && salt-call state.apply hive queue=True;;
|
||||||
|
"steno") docker stop so-steno && docker rm so-steno && salt-call state.apply pcap queue=True;;
|
||||||
|
*) docker stop so-$1 ; docker rm so-$1 ; salt-call state.apply $1 queue=True;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo -e "\nPlease provide an argument by running like so-restart $component, or by using the component-specific script.\nEx. so-restart filebeat, or so-filebeat-restart\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $1 in
|
|
||||||
"cortex") docker stop so-thehive-cortex so-thehive && docker rm so-thehive-cortex so-thehive && salt-call state.apply hive queue=True;;
|
|
||||||
"steno") docker stop so-steno && docker rm so-steno && salt-call state.apply pcap queue=True;;
|
|
||||||
*) docker stop so-$1 ; docker rm so-$1 ; salt-call state.apply $1 queue=True;;
|
|
||||||
esac
|
|
||||||
|
|||||||
@@ -19,18 +19,21 @@
|
|||||||
|
|
||||||
. /usr/sbin/so-common
|
. /usr/sbin/so-common
|
||||||
|
|
||||||
echo $banner
|
if [ $# -ge 1 ]; then
|
||||||
printf "Starting $1...\n\nThis could take a while if another Salt job is running. \nRun this command with --force to stop all Salt jobs before proceeding.\n"
|
echo $banner
|
||||||
echo $banner
|
printf "Starting $1...\n\nThis could take a while if another Salt job is running. \nRun this command with --force to stop all Salt jobs before proceeding.\n"
|
||||||
|
echo $banner
|
||||||
|
|
||||||
if [ "$2" = "--force" ]
|
if [ "$2" = "--force" ]; then
|
||||||
then
|
printf "\nForce-stopping all Salt jobs before proceeding\n\n"
|
||||||
printf "\nForce-stopping all Salt jobs before proceeding\n\n"
|
salt-call saltutil.kill_all_jobs
|
||||||
salt-call saltutil.kill_all_jobs
|
fi
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
"all") salt-call state.highstate queue=True;;
|
||||||
|
"steno") if docker ps | grep -q so-$1; then printf "\n$1 is already running!\n\n"; else docker rm so-$1 >/dev/null 2>&1 ; salt-call state.apply pcap queue=True; fi ;;
|
||||||
|
*) if docker ps | grep -E -q '^so-$1$'; then printf "\n$1 is already running\n\n"; else docker rm so-$1 >/dev/null 2>&1 ; salt-call state.apply $1 queue=True; fi ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
echo -e "\nPlease provide an argument by running like so-start $component, or by using the component-specific script.\nEx. so-start filebeat, or so-filebeat-start\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case $1 in
|
|
||||||
"all") salt-call state.highstate queue=True;;
|
|
||||||
"steno") if docker ps | grep -q so-$1; then printf "\n$1 is already running!\n\n"; else docker rm so-$1 >/dev/null 2>&1 ; salt-call state.apply pcap queue=True; fi ;;
|
|
||||||
*) if docker ps | grep -E -q '^so-$1$'; then printf "\n$1 is already running\n\n"; else docker rm so-$1 >/dev/null 2>&1 ; salt-call state.apply $1 queue=True; fi ;;
|
|
||||||
esac
|
|
||||||
|
|||||||
@@ -19,11 +19,15 @@
|
|||||||
|
|
||||||
. /usr/sbin/so-common
|
. /usr/sbin/so-common
|
||||||
|
|
||||||
echo $banner
|
if [ $# -ge 1 ]; then
|
||||||
printf "Stopping $1...\n"
|
echo $banner
|
||||||
echo $banner
|
printf "Stopping $1...\n"
|
||||||
|
echo $banner
|
||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
*) docker stop so-$1 ; docker rm so-$1 ;;
|
*) docker stop so-$1 ; docker rm so-$1 ;;
|
||||||
esac
|
esac
|
||||||
|
else
|
||||||
|
echo -e "\nPlease provide an argument by running like so-stop $component, or by using the component-specific script.\nEx. so-stop filebeat, or so-filebeat-stop\n"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user