Thanks Ashton,  I actually was in the middle of tackling this when your
email came in!  ;-)  I took a different approach and decided to let the
system generate the service file for me.  In case anyone wants to follow
my footsteps here is what I did -

Add the following init info comments to the beginning of the james
startup script -

### BEGIN INIT INFO
# Provides:       james
# Required-Start: $network $syslog $time
# Required-Stop:  $network $syslog $time
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Description:    Initscript for Apache James Mail Server
### END INIT INFO

Next create a soft link from /etc/init.d to the james startup script -

ln -s /mail/apache-james-3.2/james-server-app-3.2.0/bin/james
/etc/init.d/james

Next install links to the james script into the various init.d runlevels

cd /etc/init.d
insserv james

Next set up the systemd files from the new init.d configuration.

systemctl daemon-reload

and this is what this magic incantation cooked up for me -

cat /run/systemd/generator.late/james.service
# Automatically generated by systemd-sysv-generator

[Unit]
Documentation=man:systemd-sysv-generator(8)
SourcePath=/etc/init.d/james
Description=LSB: Apache James :: Server :: App
Before=multi-user.target multi-user.target multi-user.target
graphical.target
After=network-online.target time-sync.target
Wants=network-online.target time-sync.target

[Service]
Type=forking
Restart=no
TimeoutSec=5min
IgnoreSIGPIPE=no
KillMode=process
GuessMainPID=no
RemainAfterExit=yes
ExecStart=/etc/init.d/james start
ExecStop=/etc/init.d/james stop


I will copy this file to /usr/systemd/system and tweak it a bit more but
I think it got me in the ballpark... At least I can now invoke systemctl
commands on the james service. I will test some more and then go conquer
the next mountain (probably SSL/TLS) ...    Marc...



n 01/06/2019 11:39 PM, Ashton Holmes wrote:
> This is my systemd service file. It's pretty basic but it gets the job done.
> [Unit]
> Description=James mail server
>
> [Service]
> User=james
> WorkingDirectory=/opt/james/bin
> ExecStart=/opt/james/bin/run.sh
>
> [Install]
> WantedBy=multi-user.target
>
> On January 6, 2019 9:42:50 PM PST, Marc Chamberlin <m...@marcchamberlin.com> 
> wrote:
>> Just wondering if anyone has made or have an example of a james.service
>> file for running James under Systemd? Would make my life a bit easier
>> if
>> I don't have to figure out how to create one from scratch! ;-)   Thanks
>> in advance as always...   Marc..
>>
>>
>> -- 
>> Linux Counter


-- 
Linux Counter

Reply via email to