Skip to content

Commit dd77cdc

Browse files
Merge pull request #3 from jimmyatSplunk/develop
Update for reading app context
2 parents b7b3a82 + b165fed commit dd77cdc

File tree

5 files changed

+13
-3
lines changed

5 files changed

+13
-3
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.db
2+
.idea
3+
.DS_Store
File renamed without changes.

bin/appContext.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
## Grab the current app context
3+
SCRIPT_PATH=$(realpath $0)
4+
APP_PATH=$(dirname ${SCRIPT_PATH})

bin/restart.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ if ($restartInput -eq "True" -OR $restartServer -eq "True" -OR $restartDS -eq "T
3131
if ($restartDateTime -eq "True") {
3232
Remove-Item -path "$dateTimePath"
3333
}
34-
Remove-Item -path "$SPLUNKHOME\etc\apps\SplunkForwarderRepairKit\DeleteMeToRestart"
34+
Remove-Item -path "$PSScriptRoot\DeleteMeToRestart"
3535
} else {
3636
Write-output "No settings have been changed." | timestamp
3737
Write-output "No restart required." | timestamp
38-
}
38+
}

bin/restart.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/bin/bash
2+
### Source the appPath script to pull proper app context
3+
source appContext.sh
4+
25
### Configure the path to the restart_check.txt file on the system
36
RESTARTINPUT="$SPLUNK_HOME/etc/restartinput.txt"
47
RESTARTSERVER="$SPLUNK_HOME/etc/restartserver.txt"
@@ -25,7 +28,7 @@ if [ -f "$RESTARTINPUT" ] || [ -f "$RESTARTSERVER" ] || [ -f "$RESTARTDS" ] || [
2528
if [ -f "$RESTARTDATETIME" ]; then
2629
rm -f "$RESTARTDATETIME"
2730
fi
28-
rm -f $SPLUNK_HOME/etc/apps/SplunkForwarderRepairKit/DeleteMeToRestart
31+
rm -f "${APP_PATH}/DeleteMeToRestart"
2932
else
3033
echo "$(date +"%Y-%m-%d %H:%M:%S.%3N") ${HOSTNAME}: No settings have been changed."
3134
echo "$(date +"%Y-%m-%d %H:%M:%S.%3N") ${HOSTNAME}: No restart required."

0 commit comments

Comments
 (0)