I made a change in the blogger configuration to ease the later work when blogging. It is possible that older entries are not correctly formatted.

Showing posts with label init.d scripts. Show all posts
Showing posts with label init.d scripts. Show all posts

Friday, 28 June 2013

Systemd und service control under fedora

I must say I am currently a bit lost in the different mechanisms to start and stop services. I used to perform these tasks with the standard /etc/init.d/... scripts. But it seems that it does not work completely in this way. There seems to be now systemctl, service and chkconfig commands.

service sshd start

to start the ssh daemon.

service sshd stop

to stop the ssh daemon.

chkconfig sshd on

to enable the ssh daemon so as to start it after boot.


To use systemd, the following commands come handy:

systemctl start sshd.service

to start the ssh daemon.

systemctl stop sshd.service

to stop the ssh daemon.

systemctl enable sshd.service

to enable the ssh daemon so as to start it after boot.




Sunday, 25 May 2008

init scripts

For a few things I am interested in doing, I wanted to be able to have a small script preparing as soon as I boot up. Perhaps it is more interesting to use atd or cron for this but I wanted to make sure how the initscript system works.

So I prepare a small script in order to start some system tools as soon as the boot process is finished.

For example, a little tool starting a remote process when I first boot which would allow me to use some remote processing facilities, e.g (focused) crawler. This could be also some system starting before/after the httpd daemon is up.

For this I took a look at the /etc/init.d/postgres script.

#!/bin/sh # newscript This is the init script for starting up the newscript
# service
#
# chkconfig: - 99 99
# description: Starts and stops the newscript that handles \
# all newscript requests.
# processname: mynewscript
# pidfile: /var/run/mynewscript.pid

# Version 0.1 myname
# Added code to start newscript

Note the use of chkconfig: - 99 99 .

This should be adapted with more useful priorities, basically 99 means that the initscript is started as one of the last scripts. Taking a look at $man chkconfig should prove useful.

The new script stores the pid of the newscript application in /var/run/mynewscript.pid

Note that it also stores things in /var/lock/subsys/