What's the difference between starting postfix directly (postfix start
) and as a service (service postfix start
)? What (if any) is the preferred way as a best practice, and is there any way to make service postfix status
show the process as active no matter how it was started?
Some code to further clarify:
root@luke:/# postfix status; service --status-all | grep postfix
postfix/postfix-script: the Postfix mail system is running: PID: 17332
[ - ] postfix
root@luke:/# postfix stop; service postfix start
postfix/postfix-script: stopping the Postfix mail system
root@luke:/# postfix status; service --status-all | grep postfix
postfix/postfix-script: the Postfix mail system is running: PID: 18237
[ + ] postfix
Starting it as a system service is naturally the best way, everything else should only be used for testing/debugging purposes.
This way, the service is integrated into the normal startup procedure of the system and can be easily turned on or off for subsequent reboots, and you can use reporting features of your init system.
This reporting (
service xxxx status
) can't be easily achieved for manual started services and, while certainly not impossible, it would require some work of your own to make it possible (and then run into conflicts on updates).Speaking of updates, this is another important advantage of using system services, as the update mechanism can restart the service if necessary, depending on the configuration and nature of the update.