Not working .
can you post your current code?
REM by Sunil Kumar Tikar
REM No inputs required.
ECHO Stopping Tableau Server...
ECHO Backing up Tableau Server...
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -command "& 'E:\Automated Batch Files\QA_Backup_start.ps1'"
tabadmin backup %sPath%\QA_cold_backup --date
SET /a EL=%ERRORLEVEL%
IF %EL% EQU 0 GOTO Success
ECHO Backup failed.
ECHO Error number: %EL%
ECHO Backup failed Pleaase cheack Manually what is the problem.
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -command "& 'E:\Automated Batch Files\QA_Unsuccessful_Backkup.ps1'"
ECHO Backup succeeded.
ECHO Backup file saved to in directory %sPath%
ECHO File name is QA_backup-%dDate:~-4%%dDate:~4,2%%dDate:~6,2%.tsbak
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -command "& 'E:\Automated Batch Files\QA_Successful_Backkup.ps1'"
ECHO Performing cleanup...
ECHO Cleanup has done. Re-starting Tableau Server, please wait...
REM Pause execution for 300 seconds and ignore keystrokes
REM ECHO Pausing to insure server is running before continuing script.
timeout /t 300 /nobreak
tabadmin.exe status | findstr /i RUNNING
if "%errorlevel%"=="0" GOTO End
ECHO Re-start and/or Cleanup failed!
REM We want the returned error level NOT to be zero
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -command "& 'E:\Automated Batch Files\QA_Unsuccessful_Cleanup_or_Restart.ps1'"
SET /a EL=1
ECHO -- Pause --
ECHO Backup operation finished.
REM The /b will return our error level
EXIT /b %EL%
Highlighted bold part needs to be tune.I have checked its not comparing status with "running " always returns 1
1 of 1 people found this helpful
I ran this simple script to ensure the line of code works as expected.
If you run it when Tableau server is running, it echos "Condition met". If Tableau Server is stopped you will not see the echo. Can you copy the below into a .bat file and let me know if you get the correct behavior with this script when tableau Server is running AND stopped?
tabadmin status | findstr /i RUNNING
if "%errorlevel%"=="0" ECHO "Condition met"
Thanks for the effort,I observed that this code is running fine when I am running it as administrator.else its not echoing this message.
I am the administrator of this server and I kept these lines in my batch files and I am running this batch file by scheduler by creating task from task scheduler.But here only I am facting this problem all remaining tabadmin commands are working fine ..
Is there any option in task scheduler where we can say "run as administrator"??
"Make a batch file in an editor and nameit.bat then create a shortcut to it. Nameit.bat - shortcut. then right click on Nameit.bat - shortcut ->Properties->Shortcut tab -> Advanced and click Run as administrator. Execute it from the shortcut."
does that allow you to run it as administrator?
Its not running as administrator,as again its not echoing the message. when I have selection this shortcut its taking origional file only.