COPY-Test Setting up Services to Start on Boot

Setting up Services to Start on Boot

There are several ways to setup services to start on boot. These include:

  1. Windows: Startup folder, ex: c:\ProgramData\Start Menu
  2. Windows: via the registry
  3. Windows: Task Scheduler
  4. Windows: NSSM
  5. Windows: SVC.EXE/SVCSTART.EXE
  6. Linux: /etc/rc.local/
  7. Linux: /etc/init.d/ SysV LSB-compliant scripts
  8. Linux: systemd .service files
  9. Linux/Windows: using Apache Commons Daemon to install JVM apps as a service.
  10. Linux/Windows: using YAJSW to install JVM apps as a service

The following instructions will focus on the 3rd, 7th, and 8th methods.

Those methods will be used to setup Syndeia Cloud and its dependency, Cassandra, to start on boot

(warning) Note, these instruction assume the user has installed Syndeia Cloud under syndeia-cloud-current or created a symbolic link (symlink) named syndeia-cloud-current pointing to the current installed version. For instructions on how to set this up, see Appendix D4.1 for Windows and Appendix D4.2 for Linux.


Windows 2012-R2

The following instructions describe how to setup the Syndeia Cloud service to only start after the Cassandra service has fully started and the port is available on Windows via Task Scheduler.

Local-node Cassandra

1. From your installation of Syndeia Cloud, import in the Start Cassandra on boot (UTF-16).xml Task from <syndeia-cloud-home>/conf/Windows-Task-Scheduler, ie: from CMD.EXE, run schtasks /create /xml "Start Cassandra on boot (UTF-16).xml" /tn "Start Cassandra on boot".
2. From your installation of Syndeia Cloud, import in the Start Syndeia Cloud on boot with wait for local-node Cassandra (UTF-16).xml Task from <syndeia-cloud-home>/conf/Windows-Task-Scheduler, ie: from CMD.EXE, run schtasks /create /xml "Start Syndeia Cloud on boot with wait for local-node Cassandra (UTF-16).xml" /tn "Start Syndeia Cloud on boot".

(info) If the above files are unavailable, see Appendix D4.3 to create the Tasks manually via the UI for a single-node Cassandra deployment.


Remote-node Cassandra

1. From your installation of Syndeia Cloud, import in the Start Cassandra on boot (UTF-16).xml Task from <syndeia-cloud-home>/conf/Windows-Task-Scheduler, ie: from CMD.EXE, run schtasks /create /xml "Start Cassandra on boot (UTF-16).xml" /tn "Start Cassandra on boot".
2. From your installation of Syndeia Cloud, import in the Start Syndeia Cloud on boot with wait for remote-node Cassandra (UTF-16).xml Task from <syndeia-cloud-home>/conf/Windows-Task-Scheduler, ie: from CMD.EXE, run schtasks /create /xml "Start Syndeia Cloud on boot with wait for remote-node Cassandra (UTF-16).xml" /tn "Start Syndeia Cloud on boot".
3. From your installation of Syndeia Cloud, edit the wait_for_cassandra_remote_port.ps1 script file in <syndeia-cloud-home>\bin and replace server.domain with the FQDN of your server, ex: cassandra.mycompany.com, ie:

# Replace server.domain with your server FQDN/name
do {
    $result = Test-NetConnection -ComputerName "server.domain" -Port 9042 -InformationLevel "Quiet";
} until ($result)

(info) If the above files are unavailable, see Appendix D4.4 to create the Tasks manually via the UI for a multi-node Cassandra deployment.


Linux RHEL/CentOS7

The following instructions describe how to setup the Syndeia Cloud service to only start after the Cassandra service has fully started and the port is available on Linux RHEL/CentOS7 or machines with the systemd init system.

Local-node Cassandra

1. From your installation of Syndeia Cloud, copy the syndeia-cloud.local-node_cassandra.service systemd .service file from <syndeia-cloud-home>/bin/init/systemd/ to /etc/systemd/system/ as syndeia-cloud.service, ie: sudo cp /opt/icx/syndeia-cloud-3.2/bin/init/systemd/syndeia-cloud.local-node_cassandra.service /etc/systemd/system/syndeia-cloud.service.

(info) If this file is unavailable, copy and paste the code from Appendix D4.5 into the above location and comment/uncomment out the relevant section for single or multi-node Cassandra.  

2. Run sudo systemctl reload-daemon
3. Run sudo systemctl enable /etc/systemd/system/sc-*


Remote-node Cassandra

1. From your installation of Syndeia Cloud, copy the syndeia-cloud.remote-node_cassandra.service systemd .service file from <syndeia-cloud-home>/bin/init/systemd/ to /etc/systemd/system/ as syndeia-cloud.service, ie: sudo cp /opt/icx/syndeia-cloud-3.2/bin/init/systemd/syndeia-cloud.remote-node_cassandra.service /etc/systemd/system/syndeia-cloud.service

(info) If this file is unavailable, copy and paste the code from Appendix D4.5 into the above location and comment/uncomment out the relevant section for single or multi-node Cassandra.

2. From your installation of Syndeia Cloud, edit the line below the /etc/systemd/system/syndeia-cloud.service script file and replace server.domain with the FQDN of your server, ex: cassandra.mycompany.com, ie:

ExecStartPre=/bin/sh -c "echo 'Syndeia Cloud: Waiting until Cassandra port is up...';until echo test > /dev/tcp/server.domain/9042 ; do sleep 1; done;"

3. Run sudo systemctl reload-daemon
4. Run sudo systemctl enable /etc/systemd/system/sc-*


Linux SysV init based system/non-systemd

The following instructions describe how to setup the Syndeia Cloud service to only start after the Cassandra service has fully started on Linux machines with an LSB-compliant SysV init system

1. From your installation of Syndeia Cloud, copy the syndeia-cloud.init_script.bash LSB-compliant, SysV, init script from <syndeia-cloud-home>/bin/init/SysV/ to /etc/init.d/ as syndeia-cloud, ie: sudo cp /opt/icx/syndeia-cloud-3.2/bin/init/SysV/syndeia-cloud.init_script.bash /etc/init.d/syndeia-cloud.

(info) If this file is unavailable, copy and paste the code from Appendix D.6 into the above location.

2. Run sudo chkconfig syndeia-cloud