How to configure the MID Server to restart automatically when the host is restarted on RHEL 7

Jeff Boltz1
Mega Guru

Hi All,

The documentation [https://docs.servicenow.com/bundle/london-servicenow-platform/page/product/mid-server/task/t_InstallAMIDServerOnLinux.html ] to enable the MID Server to restart automatically is the init.d method:

17. To configure the MID Server to restart automatically when the host is restarted, run ${base_install_dir}/agent/bin/mid.sh install as root.

  • This command installs the MID Server as a daemon service and adds the auto start scripts to the init.d directory.
    Note: You cannot install more than one MID Server service as a daemon on a Linux host. This is a limitation of the Tanuki wrapper service.

Does anyone have the process on a RHEL 7 or above that uses sysetmctl services? instead of init.d?

Thanks,
Jeff

 

1 ACCEPTED SOLUTION

Jeff Boltz1
Mega Guru

PS, I did find these instructions in Google search: 

https://github.com/ramrexx/ServiceNow_ServiceCatalog/blob/master/documentation/midserver.adoc

Thanks ramrexx

View solution in original post

3 REPLIES 3

Jeff Boltz1
Mega Guru

PS, I did find these instructions in Google search: 

https://github.com/ramrexx/ServiceNow_ServiceCatalog/blob/master/documentation/midserver.adoc

Thanks ramrexx

Ugh, sorry about the stream of consciousness.  Here is what we did that works for us (host start/host stop), slightly different than example above:

1.  in /etc/systemd/system, create a file called mid.service

2.  Put this in the file:

[Unit]
Description=ServiceNow MID Server
After=dnsmasq.service

[Service]
Type=forking
User=[your MID user]
Group=[your MID group]
#PIDFile=[your full path]/agent/work/mid.pid #we don't need the PID file..leave as is, edit and use, or delete this line
ExecStart=[your full path]/agent/bin/mid.sh start
ExecStop=[your full path]/agent/bin/mid.sh stop

[Install]
WantedBy=multi-user.target

3.  Save the file

4.  Run:

systemctl daemon-reload

systemcl start mid

systemctl stop mid

systemctl enable mid

Clarkie1
Giga Expert

It "may" automatically work as per this knowledge base article

https://hi.service-now.com/kb_view.do?sysparm_article=KB0694126

 

For me, I created the below file (as per above github link)

[root ~]# cat /etc/systemd/system/midserver.service


[Unit]
Description=ServiceNow MID Server
After=syslog.target
After=network.target

[Service]
PIDFile=/servicenow/mid-<name>/agent/work/mid.pid
User=miduser
ExecStart=/servicenow/mid-<name>/agent/bin/mid.sh start

[Install]
WantedBy=multi-user.target

 

 

Some things are a little messy still (upgrades in particular), but it should work - I am going to reinstall with a newer download to see if that corrects the upgrade issue and keeps using the system java version with upgrades, and other niggly little things like that.