Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Saturday, 30 March 2019

Execute any command/script at system startup in Ubuntu 18.04 (LTS)

Today, after installing Ubuntu 18.04 after a long use of lower version of Ubuntu, I got there is no rc.local file in etc directory. Actually this file is used to start any script at system startup.

So, what to do if it is not available in Ubuntu 18.04?

Just create a file by typing any of given command -

sudo nano /etc/rc.local

or

sudo gedit /etc/rc.local

or

sudo cat /etc/rc.local


and paste the following text in this file -


#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0



After saving this, make it executable by command -

chmod +x /etc/rc.local


Now you can paste your scripting script in this file.

Thursday, 23 August 2018

Recover your MYSQL database if nothing works in Ubuntu/Linux.

Recently I stuck in a situation where after spending many days I couldn't resolve the my MYSQL database connectivity in my Ubuntu system. Although I tried many solutions available on the Internet, but I was unable to resolve it.

Rather than solving my problem I thought that I have made the situation more worst then earlier because of my many hit and try on the server. However, I read at many location to keep a backup of my databases. So I was saved /var/lib/mysql directory it somewhere else.

After no success, I tried to restore databases from my mysql backed up the directory in Ubuntu after a fresh installation of MYSQL database server.

So I was copied /val/lib/mysql folder before a new installation of MYSQL. After successful installation of MYSQL server I tried to restore all my databases in  new MYSQL server like this -

Open a terminal and copy/restore your saved database to MYSQL server using the command-
(I have saved my database to Desktop and database name is itcentre)

sudo cp -r Desktop/mysql/itcentre /var/lib/mysql

enter your sudo password

after coping your database file also copy these files of your /var/lib/mysql folder to the server



sudo cp  Desktop/mysql/ibdata1 /var/lib/mysql
sudo cp  Desktop/mysql/ib_logfile0 /var/lib/mysql
sudo cp  Desktop/mysql/ib_logfile1 /var/lib/mysql
sudo cp  Desktop/mysql/debian-5.7.flag /var/lib/mysql

sudo chown -R mysql:mysql /var/lib/mysql


if there is no error your database is successfully restored to MYSQL server.


Good luck !!!

Saturday, 11 November 2017

How to kill any process in Ubuntu ?

Sometime we stuck on a application when it does not respond and we would being work on multiple applications. So, how to close it?

There can be multiple way to close it. Either we can wait until it responds, or we can close it forcibly. To quit forcefully we have two options.

1. Run a kill command on terminal.
2. Any GUI application to kill any program. (easiest way)

1. Run a kill command on terminal

To kill any program using terminal we should know the exact process name from which it is running. Sometimes it may be ambiguous and mistakenly we might kill another process. So it require some expertise on Ubuntu and may not be suited to new learner. Because some users recognise any program to its icon(logo).

Let see how we can use kill command on terminal to close a application-
First open terminal by pressing Ctrl+Alt+T. It will open terminal window.
Check all running programs/processes by typing-

 ps -A 

It will show all running programs with process IDs. Note down the process ID of program that you want to kill, and Type

kill <processidofprograme>      

Let see by example -

Here I typed ps -A in terminal.
I got the list of all running programs.
I have to close the Thunderbird program which has 19177 process ID.
Then I typed kill 19177 to kill the Thunderbird.
You can also type kill -9 19177 to quit forcibly, if above command does not work.





2.  GUI application to kill any program.

Like Task Manager in Windows OS, There is also an application available in Ubuntu called System Monitor, that provides same facilities as Task Manager in Simple and easy way.

Press Windows key and type System Monitor in filter-



Click on System Monitor package. System Monitor GUI will be opened.
1. Click on Processes.
2. Find your desired processed to be closed, select it. (I have selected Thunderbird)
3. Press End Process button.
4. Confirm box will be appeared, again click on End Process button.




Monday, 5 September 2016

Automatic startup of Apache Tomcat server in ubuntu on system startup

Apache tomcat server is used to run JSP/Servlet applications. When we install tomcat in Ubuntu/Linux it does not start automatically on system startup. We have to start it manually after system startup. In windows machine it is very simple to start Tomcat on system startup. We can just configure the tomcat service to automatic and it starts on system startup, But when we use tomcat in Ubuntu/Linux, it becomes sometime complex to start tomcat in system startup.

Some people suggest write to shell script to start tomcat, writing shell script is again complex. I have applied many methods to start tomcat in Ubuntu automatically, but I found this method is very simple to start Tomcat in Ubuntu.

Go to rc.local file in etc in root folder and open it with root privileges. Write the startup.sh path in this file and save.

sleep 10
/home/arvind/apache-tomcat-8.0.32/bin/startup.sh


Thursday, 28 January 2016

Grub rescue in Ubuntu 14.04 (LTS)

My title
If you have a multi-boot machine with Ubuntu 14.04, and mistakenly you have deleted the any partition. Normally your boot loader (Grub generally) goes into rescue mode. And you can not boot your system for any other OS installed on your system.

When you boot your system you get a black screen with grub rescue command prompt like grub rescue> .

Don't worry if you get screen like this.

Just type

grub rescue > ls
output will be like this
(hd0) (hd0,msdos5) (hd0,msdos3) (hd0,msdos2) (hd0,msdos1) (hd1) (hd1,msdos1)
then type
grub rescue > ls (hd0,msdos1)
output may be
Unknown filesystem

try above command with all partitions until you get output like 
file system is ext4 or any other valid linux file type

grub rescue > ls (hd0,msdos2) # let's assume this is the linux partition
grub rescue > set root=(hd0,msdos2)
grub rescue > set prefix=(hd0,msdos2)/boot/grub 
grub rescue > insmod normal 
grub rescue > normal

Noe you system will boot in normal grub boot mode. You will have to run these commands on every boot up until you repair or reinstall your grub boot loader.

Thursday, 27 August 2015

Customize your Ubuntu/Linux Environment using "CompizConfig Settings Manager,

My title

Compiz is a compositing manager, which means that it enhances the overall user interaction by adding fancy effects to your windows, from drop shadows to awesome desktop effects like the Desktop Cube or the Expo view.

Compiz can also be a window manager, which means that it is the software between you and your desktop apps. It enables you to move or resize windows, to switch workspaces, to switch windows easily (using alt-tab or so), and so on.

How to install

1. you can download from launchpad website or www.compiz.org.



                                                                             OR



Remember this package depends on :-

Package relationships
So your system should have these packages before installing this package.

2. Then install deb package using terminal


 sudo dpkg -i compizconfig-settings-manager_0.9.11+14.04.20140409-0ubuntu1_all.deb



3 All done.

4. Now use it very carefully otherwise you can dump your desktop.


You will also need to install compiz plugins. Run the following command -

sudo apt-get install compiz compizconfig-settings-manager compiz-plugins

Good Luck !!!!

References:-
http://askubuntu.com/questions/449651/how-do-i-enable-wobbly-windows
https://launchpad.net/ubuntu/trusty/+package/compizconfig-settings-manager
http://www.compiz.org/

Change image source dynamically on hyperlink

 Changing image source dynamically using JQuery. Here in this example I have created there hyperlink and stored all images in the same folde...