GithubHelp home page GithubHelp logo

alexminator99 / sys_daemon Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 19 KB

Test repository for daemon process in Linux

License: GNU General Public License v3.0

Makefile 3.72% C 90.14% Shell 6.14%

sys_daemon's Introduction

sys_daemon

Class Excercise

Logger

For the creation of the logger, execute next command in the directory where Makefile is:

make

This will generate a static library called libfile_log.a as the file file_log.o.


In order to clean files created (.o .a):

make clean

Run service

Once archives are generated, we can install the service by following the next steps:

  • Inside file file_chkc.service change path_to_executable with the directory where the logger is placed
  • Copy file_chkd.service inside directory /etc/systemd/system/:
sudo cp file_chkd.service /etc/systemd/system/

Note: Don't forget to run it as sudo, otherwise it will throw permission denied.

  • Reload and notify system that a new .service is placed:
sudo systemctl daemon-reload

Service status

To init, stop and see status of the unit, we can use the script filecheck by using one of these commands:

  • Start service:
./filechkd start
  • Stop service:
 ./filechkd stop
  • See service status:
 ./filechkd status

Makefile

The Makefile file first creates the file_log.o by using -lsystemd cause journal is not present as a static library but as dynamic. After that, it creates the lib libfile_log.a and it uses the static library in order to compile and generate the watcher.

Filecheck Script

The script is quite simple. We define the name of the service and we simple make system calls in order to start/stop it. As an example:

start() {
    echo "Initiating service..."
    sudo systemctl start ${service}
    echo "Service is running..."
}

References

This README.md is availble in spanish in the this link.

sys_daemon's People

Contributors

alexminator99 avatar

Stargazers

Yasiel Cabrera avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.