#!/bin/bash
read -p "Enter the new IP address i.e: 10.50.4.243/20 : " ip_address
read -p "Enter the new gateway i.e:- 10.50.0.1 : " gateway
read -p "Enter the new hostname i.e: co7-50-4-243 : " hostname
# Get the interface name
interface=$(ip route | awk '/default/ { print $5 }')
# Get the ip address
ipa=$(hostname -I | awk '{ print $1 }')
# Update the IP address and gateway
echo "Updating IP address and gateway..."
nmcli con mod "$interface" ipv4.address "$ip_address"
nmcli con mod "$interface" ipv4.gateway "$gateway"
# Update the hostname
echo "Updating hostname..."
hostnamectl set-hostname "$hostname"
# Update the /etc/hosts file
echo "Updating /etc/hosts file..."
echo "$ipa $hostname" >> /etc/hosts
# Restart the network service
echo "Restarting network service..."
systemctl restart NetworkManager
echo "IP address, gateway, hostname, and /etc/hosts file updated successfully."
Showing posts with label centOS. Show all posts
Showing posts with label centOS. Show all posts
Monday, July 24, 2023
How to Update CentOS IP and Hostname via Bash Script
I have created below mentioned bash script which will help you to update the IP Address and the hostname of the CentOS machines via this bash script.
Tuesday, October 17, 2017
Starting and Stopping Oracle Service in Linux
Starting Oracle
login as: root on your oracle installed system
To verify service and ports are listening up check with these commands
[root@CENTOS ~]# netstat -ntpul | grep :1521
[root@CENTOS ~]# netstat -ntpul | grep :1522
Then switch to oracle user for starting services
[root@CENTOS ~]# su - oracle
Then start services with these command
[oracle@CENTOS ~]$ lsnrctl start
The command completed successfully
Then run this command
[oracle@CENTOS ~]$ sqlplus
Then run this command
Enter user-name: sys as sysdbaEnter password: mind123
Connected to an idle instance.
SQL> startup
quit command from exit from sql console
SQL> quit
Run this command to start web interface console to manage Oracle database
[oracle@CENTOS ~]$ emctl start dbconsole
Starting Oracle Enterprise Manager 11g Database Control............. started.
Shutdown Oracle Database
To shutdown Oracle server use this command.
[oracle@CENTOS ~]$ sqlplus
Then run this command
Enter user-name: sys as sysdbaEnter password: mind123
Connected to an idle instance.
SQL> shutdown immediateselect TABLE_NAME,TABLESPACE_NAME,STATUS,NUM_ROWS,AVG_ROW_LEN,BLOCKS,EMPTY_BLOCKS from SYS.USER_TABLES WHERE TABLE_NAME LIKE '%RULE_SET*%';How to install XenCenter on Linux
Install OpenXenManager on Debian or Ubuntu
$ sudo apt-get install git python-gtk2 glade python-gtk-vnc python-glade2 python-configobj
$ git clone https://github.com/OpenXenManager/openxenmanager.git
$ cd openxenmanager
$ sudo python setup.py install
Install OpenXenManager on CentOS, Fedora or RHEL
$ sudo yum install pygtk2 gtk-vnc-python rrdtool
$ git clone https://github.com/OpenXenManager/openxenmanager.git
$ cd openxenmanager
$ sudo python setup.py install
Manage XenServer Host Remotely with OpenXenManager
To launch OpenXenManager, just type the following command:
$ openxenmanager
Connect to a remote XenServer host by clicking on "Add New Server" button on the top.
Subscribe to:
Posts (Atom)