Wednesday, July 20, 2011

Using systemd to start IndiMail

systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. systemd provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux cgroups, supports snapshots and restoring of the system state, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic. It can work as a drop-in replacement for sysvinit.

The first step is to write the service configuration file for IndiMail as /lib/systemd/system/indimail.service


[Unit]
Description=IndiMail Messaging Platform
After=local-fs.target network.target

[Service]
ExecStart=/var/indimail/bin/svscanboot /service
ExecStop=/etc/init.d/indimail stop
Restart=on-failure
Type=simple

[Install]
WantedBy=multi-user.target


In Fedora 15, upstart has been replaced by a service called systemd. Due to improper rpm package upgrade scripts, some system services previously enabled in Fedora 14, may not be enabled after upgrading to Fedora 15. To determine if a service is impacted, run the systemctl status command as shown below.

# systemctl is-enabled indimail.service && echo "Enabled on boot" || echo "Disabled on boot"


To enable indimail service on boot, run the following systemctl command


# systemctl enable indimail.service

Now to start IndiMail you can use the usual service command

# service indimail start    (to start indimail)

# service indimail stop     (to stop indimail)

You can automate the above service creation for systemd by running the initsvc(1) command


# /var/indimail/bin/initsvc -on  (to enable indimail service)
# /var/indimail/bin/initsvc -off   (to disable indimail service)

You can now also query the status of the running IndiMail service by using the systemctl command


# systemctl status indimail.service
indimail.service - IndiMail Messaging Platform
          Loaded: loaded (/lib/systemd/system/indimail.service)
          Active: active (running) since Wed, 20 Jul 2011 18:18:35 +0530; 10min ago
        Main PID: 4353 (svscanboot)
          CGroup: name=systemd:/system/indimail.service
                  ├ 4353 /bin/sh /var/indimail/bin/svscanboot
                  ├ 4356 /var/indimail/bin/svscan /service
                  ├ 4357 supervise log
                  ├ 4358 supervise clamd
                  ├ 4359 supervise log
                  ├ 4360 supervise freshclam
                  ├ 4361 supervise log
                  ├ 4362 supervise qmail-send.25
                  ├ 4363 supervise log
                  ├ 4364 supervise qmail-pop3d-ssl.995
                  ├ 4365 supervise log
                  ├ 4366 supervise proxy-imapd-ssl.9143
                  ├ 4367 supervise log
                  ├ 4368 supervise qmail-poppass.106
                  ├ 4369 supervise log
                  ├ 4370 supervise proxy-imapd.4143
                  ├ 4371 supervise log
                  ├ 4372 supervise proxy-pop3d-ssl.9110
                  ├ 4373 supervise log
                  ├ 4374 supervise qmail-smtpd.465
                  ├ 4375 supervise log
                  ├ 4376 supervise inlookup.infifo
                  ├ 4377 supervise log
                  ├ 4378 supervise qmail-smtpd.366
                  ├ 4379 supervise log
                  ├ 4380 supervise proxy-pop3d.4110
                  ├ 4381 supervise log
                  ├ 4382 supervise slapd.389
                  ├ 4383 supervise log
                  ├ 4384 supervise qmail-smtpd.587
                  ├ 4385 supervise log
                  ├ 4386 supervise pwdlookup
                  ├ 4387 supervise log
                  ├ 4388 supervise qmail-pop3d.110
                  ├ 4389 supervise log
                  ├ 4390 supervise qmail-qmtpd.209
                  ├ 4391 supervise log
                  ├ 4392 supervise fetchmail
                  ├ 4393 supervise log
                  ├ 4394 supervise qscanq
                  ├ 4395 supervise log
                  ├ 4396 supervise qmail-smtpd.25
                  ├ 4397 supervise log
                  ├ 4398 supervise mysql.3306
                  ├ 4399 supervise log
                  ├ 4400 supervise qmail-spamlog
                  ├ 4401 supervise log
                  ├ 4402 supervise qmail-qmqpd.628
                  ├ 4403 supervise log
                  ├ 4404 supervise qmail-imapd-ssl.993
                  ├ 4405 supervise log
                  ├ 4406 supervise indisrvr.4000
                  ├ 4407 supervise log
                  ├ 4408 supervise qmail-imapd.143
                  ├ 4409 supervise log
                  ├ 4410 supervise greylist.1999
                  ├ 4411 supervise log
                  ├ 4412 /var/indimail/bin/multilog t /var/log/indimail/fre...
                  ├ 4413 qmail-daemon ./Maildir/
                  ├ 4414 /var/indimail/bin/tcpserver -v -H -R -l 0 -x /var/...
                  ├ 4415 /var/indimail/bin/tcpserver -v -c /service/qmail-p...
                  ├ 4416 /var/indimail/bin/multilog t /var/log/indimail/pro...
                  ├ 4417 /var/indimail/bin/multilog t /var/log/indimail/pop...
                  ├ 4418 /var/indimail/bin/multilog t /var/log/indimail/pro...
                  ├ 4419 /var/indimail/bin/multilog t /var/log/indimail/pro...
                  ├ 4420 /var/indimail/bin/multilog t /var/log/indimail/pop...
                  ├ 4421 /var/indimail/bin/tcpserver -v -c /service/qmail-p...
                  ├ 4422 /var/indimail/bin/multilog t /var/log/indimail/pro...
                  ├ 4424 /var/indimail/bin/tcpserver -v -c /service/proxy-p...
                  ├ 4425 /var/indimail/bin/multilog t -* cleanq starting -*...
                  ├ 4426 /var/indimail/bin/tcpserver -v -h -R -l 0 -x /var/...
                  ├ 4427 /var/indimail/bin/tcpserver -v -c /service/proxy-i...
                  ├ 4428 /var/indimail/sbin/inlookup -i 5
                  ├ 4429 /var/indimail/bin/multilog t /var/log/indimail/mys...
                  ├ 4430 /var/indimail/bin/multilog t /var/log/indimail/smt...
                  ├ 4431 /var/indimail/sbin/nssd -d notice
                  ├ 4432 /var/indimail/bin/tcpserver -v -c /service/qmail-i...
                  ├ 4433 /var/indimail/bin/multilog t /var/log/indimail/pwd...
                  ├ 4434 /var/indimail/bin/multilog t /var/log/indimail/smt...
                  ├ 4435 /var/indimail/bin/multilog t /var/log/indimail/pop...
                  ├ 4436 /var/indimail/bin/tcpserver -v -c /service/proxy-i...
                  ├ 4437 /var/indimail/bin/multilog t /var/log/indimail/inl...
                  ├ 4438 /usr/bin/perl /var/indimail/bin/greydaemon -w /var...
                  ├ 4439 /var/indimail/bin/tcpserver -v -c /service/qmail-i...
                  ├ 4440 /var/indimail/bin/tcpserver -v -h -R -l 0 -x /var/...
                  ├ 4441 /var/indimail/bin/multilog t /var/log/indimail/ima...
                  ├ 4442 /var/indimail/bin/tcpserver -v -H -R -l 0 -x /var/...
                  ├ 4443 /var/indimail/bin/multilog t /var/log/indimail/gre...
                  ├ 4444 /usr/local/mysql/libexec/mysqld --defaults-file=/v...
                  ├ 4445 /var/indimail/bin/tcpserver -v -H -R -l 0 -x /var/...
                  ├ 4446 /var/indimail/bin/qmail-cat /tmp/spamfifo
                  ├ 4447 /var/indimail/bin/multilog t /var/log/indimail/fet...
                  ├ 4448 /var/indimail/bin/multilog t /var/log/indimail/qmq...
                  ├ 4449 /var/indimail/bin/multilog t /var/log/indimail/smt...
                  ├ 4450 /var/indimail/bin/multilog t /var/log/indimail/qmt...
                  ├ 4451 /var/indimail/bin/tcpserver -v -H -R -l 0 -x /var/...
                  ├ 4452 /var/indimail/sbin/indisrvr -i 0 -p 4000 -b 40 -n ...
                  ├ 4453 /var/indimail/bin/multilog t /var/log/indimail/ind...
                  ├ 4454 /var/indimail/bin/multilog t /var/log/indimail/smt...
                  ├ 4455 /var/indimail/bin/multilog t /var/log/indimail/cla...
                  ├ 4456 /var/indimail/bin/multilog t /var/log/indimail/svs...
                  ├ 4457 /var/indimail/sbin/clamd
                  ├ 4458 /var/indimail/bin/multilog t /var/log/indimail/del...
                  ├ 4459 /var/indimail/bin/tcpserver -v -c /service/proxy-p...
                  ├ 4460 /var/indimail/bin/multilog t /var/log/indimail/spa...
                  ├ 4461 /var/indimail/bin/multilog t /var/log/indimail/ima...
                  ├ 4462 /bin/sh ./run
                  ├ 4477 /var/indimail/bin/multilog t /var/log/indimail/sla...
                  ├ 4509 /var/indimail/bin/freshclam -v --stdout --datadir=...
                  ├ 4519 /var/indimail/sbin/inlookup -i 5
                  ├ 4520 /var/indimail/sbin/inlookup -i 5
                  ├ 4521 /var/indimail/sbin/inlookup -i 5
                  ├ 4522 /var/indimail/sbin/inlookup -i 5
                  ├ 4523 /var/indimail/sbin/inlookup -i 5
                  ├ 4526 qmail-send
                  ├ 4527 qmail-send
                  ├ 4528 qmail-send
                  ├ 4529 qmail-send
                  ├ 4530 qmail-send
                  ├ 4531 qmail-lspawn ./Maildir/
                  ├ 4532 qmail-rspawn
                  ├ 4533 qmail-clean
                  ├ 4534 qmail-todo
                  ├ 4535 qmail-clean
                  ├ 4536 qmail-lspawn ./Maildir/
                  ├ 4537 qmail-rspawn
                  ├ 4538 qmail-clean
                  ├ 4539 qmail-todo
                  ├ 4540 qmail-clean
                  ├ 4541 qmail-lspawn ./Maildir/
                  ├ 4542 qmail-rspawn
                  ├ 4543 qmail-clean
                  ├ 4544 qmail-todo
                  ├ 4545 qmail-clean
                  ├ 4546 qmail-lspawn ./Maildir/
                  ├ 4547 qmail-rspawn
                  ├ 4548 qmail-clean
                  ├ 4549 qmail-todo
                  ├ 4550 qmail-clean
                  ├ 4551 qmail-lspawn ./Maildir/
                  ├ 4552 qmail-rspawn
                  ├ 4553 qmail-clean
                  ├ 4554 qmail-todo
                  ├ 4555 qmail-clean
                  ├ 4751 /bin/sh ./run
                  └ 4752 sleep 200

No comments:

IndiMail Queue Mechanism

Indimail has the ability of configuring multiple local and remote queues. A queue is a location on your hard disk where email are deposited ...