Question

In linux your task is to automatically start and stop the ‘gnome-calculator’ application with the following...

In linux your task is to automatically start and stop the ‘gnome-calculator’ application with the following guidelines:

  1. Create a script that will accept either a stop, status or start argument.
  2. You should create the necessary link files in startup section under /etc/rc2.d using 159 start. Meaning you should have S159gnomecalculator
  3. The program must contain a ‘case’ statement and set the proper local variable.
  4. Please provide the script along with a screenshot of your link files.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi,

Here is the solution. please use root user to run the application because of link file and add argument like start,stop,status.

Here is Some Screenshots:

Screenshots:

Here is the code below. I hope you will like it. Please give the positive rating if you like it. Please comment below if you need to ask something.

-----------------------------------

#!/bin/bash

#sudo ln -s /home/kapil/Documents/control-script.sh /etc/rc2.d/159

myvar="$PWD"
#echo $myvar

file="/etc/rc2.d/"
if [ -f "159" ]
then
   echo ""

else
   sudo ln -s $myvar/control-script.sh /etc/rc2.d/159
   chmod +x /etc/rc2.d/159
fi

status= ps -ef | grep gnome-calculator | grep -v grep | awk '{print $2}'


case "$1" in
"start")
   echo "Starting the application"
   /usr/bin/gnome-calculator
;;
"status")
   blank=""
    if [ $status == $blank ]
   then
       echo "Not Running"

   else
       echo "Running"
   fi
;;
"stop")
   echo "Stoping the application"
   ps -ef | grep gnome-calculator | grep -v grep | awk '{print $2}' | xargs kill
;;
esac

----------------------------------

Thank you.....

Add a comment
Know the answer?
Add Answer to:
In linux your task is to automatically start and stop the ‘gnome-calculator’ application with the following...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Login to Suse Linux as root. Complete the task working as the root user. 1. What...

    Login to Suse Linux as root. Complete the task working as the root user. 1. What is your current directory. What did you enter at the command prompt to determine your current working directory? 2. Change directories if needed to find your foods (or food) file. Use vi to make the file contain 10 food items. Save your file and quit. Use the cat command, and option, and the argument food to display the food file with numbered lines. Use...

  • Task (Python) A lot of police investigations start off by examining where the potential suspects was...

    Task (Python) A lot of police investigations start off by examining where the potential suspects was at the time of the crime. This is often done by asking phone companies to provide lists of all mobile phones that was in the area where the crime was committed around the time when it was committed. If there is only one crime scene this is not a big problem but if there are several crime scenes then the task of cross referencing...

  • For milestone #1, we will start the CARIT site with three static HTML pages and a...

    For milestone #1, we will start the CARIT site with three static HTML pages and a CSS file. Create a dedicated folder for this project. This folder should contain all related files in this project. The future milestones are cumulative and built directly on top of your prior work. Function/content requirements: A home page named “index.html”, which include these contents at least: Description of the center. You may reference the example sites. Latest news: use list tags; make up some...

  • For this assignment your job is to create a two class application that examines the concept...

    For this assignment your job is to create a two class application that examines the concept of a numerical palindrome. A numerical palindrome is a non-negative whole number that is the same forwards and backwards, e.g. 2332, 12321, etc. Here's the catch: suppose you do the following. Start with any positive whole number. If it's a palindrome, you're done; if it isn't, reverse the number, add the reversal to the original value, and test this new result. It it's a...

  • Need this in C++ Goals: Your task is to implement a binary search tree of linked...

    Need this in C++ Goals: Your task is to implement a binary search tree of linked lists of movies. Tree nodes will contain a letter of the alphabet and a linked list. The linked list will be an alphabetically sorted list of movies which start with that letter. MovieTree() ➔ Constructor: Initialize any member variables of the class to default ~MovieTree() ➔ Destructor: Free all memory that was allocated void printMovieInventory() ➔ Print every movie in the data structure in...

  • Tokeniser in C++

    TokenisersBackgroundThe primary task of any language translator is to work out how the structure and meaning of an input in a given language so that an appropriate translation can be output in another language. If you think of this in terms of a natural language such as English. When you attempt to read a sentence you do not spend your time worrying about what characters there are, how much space is between the letters or where lines are broken. What...

  • PROBLEM STATEMENT: Suppose you have a client that has given you the following business rules to...

    PROBLEM STATEMENT: Suppose you have a client that has given you the following business rules to form the basis for a database design. The database must enable the manager of a company dinner club to mail invitations to the club’s members, to plan the meals, to keep track of who attends the dinners, and so on. Each dinner serves many members, and each member may attend many dinners. A member receives many invitations, and each invitation is mailed to many...

  • Game Description: Most of you have played a very interesting game “Snake” on your old Nokia...

    Game Description: Most of you have played a very interesting game “Snake” on your old Nokia phones (Black & White). Now it is your time to create it with more interesting colors and features. When the game is started a snake is controlled by up, down, left and right keys to eat food which appears on random locations. By eating food snake’s length increases one unit and player’s score increases by 5 points. Food disappears after 15 seconds and appears...

  • 18.1 Lab Lesson 11 (Part 1 of 1) Part of lab lesson 11 There in one...

    18.1 Lab Lesson 11 (Part 1 of 1) Part of lab lesson 11 There in one part to lab lesson 11. The entire lab will be worth 100 points. Lab lesson 11 part 1 is worth 100 points For part 1 you will have 80 points if you enter the program and successfully run the program tests. An additional 20 points will be based on the style and formatting of your C++ code. Style points The 20 points for coding...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT