GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Urgent request to convert batch script to korn she...
Operating System - HP-UX
1847384
Members
3441
Online
110264
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-13-2006 05:07 PM
11-13-2006 05:07 PM
Urgent request to convert batch script to korn shell script
Hello Team,
I have some small batch scripts which need to be converted into korn shell scripts, can anyone assist me converting these scripts to korn shell. Its pretty urgent
Below is the script called cleanUPLog.bat
@ECHO OFF
:Init
SETLOCAL
SET WebTopSystemName=""
IF /I %COMPUTERNAME%==N00402AP040 SET WebtopSystemName=WAS
IF /I %COMPUTERNAME%==N00402AP041 SET WebtopSystemName=WAS
IF /I %COMPUTERNAME%==N00402AP043 SET WebtopSystemName=WAS
IF /I %COMPUTERNAME%==N00402AP044 SET WebtopSystemName=WAS
IF /I %COMPUTERNAME%==N00402AP045 SET WebtopSystemName=WAS
IF /I %COMPUTERNAME%==N00402AP046 SET WebtopSystemName=WAS
IF /I %COMPUTERNAME%==N00402I0040 SET WebtopSystemName=IHS
IF /I %COMPUTERNAME%==N00402I0041 SET WebtopSystemName=IHS
IF /I %COMPUTERNAME%==N00402I0043 SET WebtopSystemName=IHS
IF /I %COMPUTERNAME%==N00402I0044 SET WebtopSystemName=IHS
IF /I %COMPUTERNAME%==N00402I0045 SET WebtopSystemName=IHS
IF /I %COMPUTERNAME%==N00402I0046 SET WebtopSystemName=IHS
IF %WebtopSystemName%=="" GOTO WrongMachine
SET systemtype=%WebtopSystemName%
SET datedifflimit=%1
SET calledproclib="E:\Applications\Batchfiles\Webtop\Cleanup\"
:CheckforDaysToDeleteparam
IF "%1"=="" (GOTO HOWTOUSE)
IF %systemtype%==WAS SET ArchiveDir=E:\Logs\Webtop\Archive
IF %systemtype%==IHS SET ArchiveDir="E:\logs\IHS\archive"
:START
:GettodaysDateInformation
FOR /f "tokens=2-4 delims=/ " %%a IN ('date /t') DO SET todayfulldate=%%c-%%b-%%a
FOR /f "tokens=2-4 delims=/ " %%a IN ('date /t') DO SET todayyear=%%c
FOR /f "tokens=2-4 delims=/ " %%a IN ('date /t') DO SET todaymonth=%%b
FOR /f "tokens=2-4 delims=/ " %%a IN ('date /t') DO SET todaydate=%%a
:CalculatetodaysDateOffset
SET dateoffsetresult=0
ECHO Todays date is : %todayyear%-%todaymonth%-%todaydate%
CALL %calledproclib%CleanUpOldLogs-calculateDays.bat %todayyear% %todaymonth% %todaydate%
SET todayoffset=%dateoffsetresult%
ECHO Today offset : %todayoffset%
:GetlogsDateInformation
FOR /F %%A IN ('DIR /B /A:-D %ArchiveDir%') DO (
CALL %calledproclib%CleanUpOldLogs-deletelogic.bat %%A
)
GOTO EOF
:WrongMachine
REM ************************************************************************************
REM * *
REM * This script didn't recognise the Computer Name on which it was running. *
REM * It was written to be run on Webtop WAS & IHS Servers only. *
REM * *
REM ************************************************************************************
ECHO !!! ERROR !!!
ECHO *************
ECHO Execution Terminated!
ECHO This script didn't recognise Computer Name %COMPUTERNAME% - Please Inform Webtop Support!!
GOTO EOF
:HOWTOUSE
ECHO ######################################
ECHO # Name : CleanUpOldLogs-main.bat
ECHO #
ECHO # Usage : CleanUpOldLogs-main.bat [system] [number of days of logs to keep]
ECHO # Usage : CleanUpOldLogs-main.bat IHS 20
ECHO # Usage : CleanUpOldLogs-main.bat WAS 5
ECHO # Usage : CleanUpOldLogs-main.bat WAS 1898
ECHO # Notes : [number of days of logs to keep] parameter must be 1 or greater.
ECHO # Notes : If [number of days of logs to keep] == 1, then it WILL delete yesterday's logs.
ECHO # Notes : If [number of days of logs to keep] == 2, then it keep yesterday's logs. Will delete the day before yesterday's logs.
ECHO # Notes : If [number of days of logs to keep] == 0, (special case). Will delete all dated logs. Even if in the future.
ECHO #
ECHO ######################################
:ReturnWithError
ECHO An ERROR has occurred1.
COLOR 00
:EOF
ENDLOCAL
Thanks Heaps.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP