🐧
Linux
  • syllabus
  • unit 1-Introduction
    • Unit I: Introduction to Linux
    • 2. Advantages of Linux over other operating systems
    • 3.File systems
    • 4.Culture of free software
  • unit 2-Basics of Linux
    • 1.Commands
    • 2.shell
    • 3.Text Editors
    • 4.The file system of Linux
    • 5.Directories and their special purpose
    • 6.permission
  • unit 3-Installation
    • 1. Partitioning
    • 2. Installation of Linux
    • 3. Troubleshooting of installation
  • unit 4-System Administration
    • 1.Root login
    • 2.Superuser
    • 3.Configuration of hardware with kudzu
    • 4. Checking System Space:
    • 5. Monitoring System Performance:
    • 6. Working with a File System:
    • 7.Configuring modules
    • 8.jail shell
    • 9.awk
    • 10.sed
  • unit 5-User Management
    • 1.Creating user accounts
    • 2.Setting user defaults
    • 3.Providing support to users
    • 4.Modifying accounts
    • 5.Deleting user accounts
    • 6.Checking disk quotas
    • 7.Sending mail to all users
  • unit 6-Security and System Handling
    • 1.Understanding shell scripts
    • 2.System startup and shutdown
    • 3.Scheduling system tasks
    • 4.Backing up and restoring
    • 5.Password protection
    • 6.File security
  • unit 7-Setting up a Web Server
    • 1.Introduction to a web server
    • 2.Starting the Apache webserver
    • 3.Configuring the Apache webserver
    • 4.Monitoring server activities
  • unit 8-Setting up DHCP and NIS
    • 1.Introduction to DHCP
    • 2.Setting up DHCP Server
    • 3.Setting up DHCP Client
    • 4.Understand NIS
  • unit 9-Setting up a Database Server
    • 1.Configuring database server
    • 2.Checking the status
    • 3.Working with database
  • unit 10-Setting up DNS
    • 1.Introduction to DNS
    • 2.Setting up DNS and configuration
    • 3.Querying DNS
  • unit 11-ISP Simulation
    • 1.Integration of servers
    • 2.DNS, Web, Email, etc
  • fullform
  • Assignment
  • Practicals
    • 1.Linux utilities
    • 2.OS installation project work
    • 3.User management using a terminal
    • 4.Security level access control list
    • 1.Network setting
    • 2.Server configuration of DHCP, DNS, Database server
    • 3.Demonstration of the web, mail, file server
  • imp questions
    • short-notes
    • unit 1
    • unit 2
    • unit 3
    • unit 4
    • unit 5
    • unit 6
    • unit 7
    • unit 8
    • unit 9
    • unit 10
    • unit 11
    • unit ii
  • services
    • create_service
  • Viva+Practical
    • VIVA questions
    • Practical questions
Powered by GitBook
On this page
  • Services
  • check available service

Was this helpful?

  1. services

create_service

Services

To add a service in Linux, you typically need to create a systemd service unit file. Here's a step-by-step guide on how to add a service in Linux (assuming you are using a systemd-based distribution like Ubuntu):

  1. Create a service unit file:

    sudo nano /etc/systemd/system/my-service.service

    Replace my-service with a meaningful name for your service.

  2. In the nano editor, enter the following content for the service unit file:

    [Unit]
    Description=My Service
    After=network.target
    
    [Service]
    ExecStart=/path/to/your/service-executable
    WorkingDirectory=/path/to/your/service-working-directory
    Restart=always
    
    [Install]
    WantedBy=multi-user.target

    Make sure to replace /path/to/your/service-executable with the actual path to your service executable and /path/to/your/service-working-directory with the directory where your service should run.

    You can customize other options in the service unit file according to your specific requirements.

  3. Save the file by pressing Ctrl+O, and then exit nano by pressing Ctrl+X.

  4. Reload systemd to load the new service(if your are creating service for the first time then you dont need this step):

    sudo systemctl daemon-reload
  5. Start the service:

    sudo systemctl start my-service

    Replace my-service with the name you used for your service in the unit file.

  6. Verify the status of the service:

    sudo systemctl status my-service

    This command will display the current status and some information about the service.

  7. Enable the service to start automatically at boot:

    sudo systemctl enable my-service

    This ensures that your service will be started automatically when the system boots up.

That's it! Your service should now be added and running on your Linux server. You can use systemctl commands (e.g., start, stop, restart, status) to manage the service as needed.

check available service

To check the list of services running on a Linux server, you can use the systemctl command in linux. Here's how you can do it:

  1. Open a terminal on your Ubuntu server.

  2. Type the following command and press Enter:

    systemctl list-units --type=service

This command will display a list of all services along with their current status (whether they are running or not) on your Ubuntu server.

If you want to view more details about each service, you can add the --all flag to the command:

systemctl list-units --type=service --all

This will provide additional information such as the service description, whether the service is enabled to start at boot, and its current state.

Note that you may need administrative privileges (sudo) to execute this command, depending on your system configuration.

PreviousservicesNextViva+Practical

Last updated 1 year ago

Was this helpful?