0% found this document useful (0 votes)
4 views1 page

Kernel Upgrade Script

This Bash script automates the kernel upgrade process for an SAP system. It includes steps to stop the SAP system, back up the existing kernel, copy new kernel files, set proper permissions, and restart the SAP system. The script uses variables for configuration and timestamps for backup directories.

Uploaded by

davoodpathan7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views1 page

Kernel Upgrade Script

This Bash script automates the kernel upgrade process for an SAP system. It includes steps to stop the SAP system, back up the existing kernel, copy new kernel files, set proper permissions, and restart the SAP system. The script uses variables for configuration and timestamps for backup directories.

Uploaded by

davoodpathan7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

#!

/bin/bash

# Define variables
SAPSID="DEV" # Change to your system ID
INSTANCE_NO="00" # Change to your instance number
KERNEL_DIR="/usr/sap/$SAPSID/exe" # Target kernel directory
SOURCE_KERNEL="/sapmedia/new_kernel" # Path to new kernel files
USER="sapadm" # SAP admin user
DATESTAMP=$(date +%Y%m%d_%H%M%S)

echo "Starting kernel upgrade for $SAPSID at $DATESTAMP"

# Step 1: Stop SAP system


echo "Stopping SAP system..."
su - $USER -c "stopsap $SAPSID"

# Step 2: Backup existing kernel


echo "Backing up existing kernel..."
mkdir -p "${KERNEL_DIR}/backup_$DATESTAMP"
cp -pr ${KERNEL_DIR}/* "${KERNEL_DIR}/backup_$DATESTAMP/"

# Step 3: Copy new kernel files


echo "Copying new kernel files..."
cp -pr ${SOURCE_KERNEL}/* ${KERNEL_DIR}/

# Step 4: Set proper permissions


echo "Updating file permissions..."
chown -R ${USER}:sapsys ${KERNEL_DIR}
chmod -R 755 ${KERNEL_DIR}

# Step 5: Start SAP system


echo "Starting SAP system..."
su - $USER -c "startsap $SAPSID"

echo "Kernel upgrade completed successfully for $SAPSID.

You might also like