Skip to main content
McAfee MVISION Cloud

Specify the User to Start Cloud Connector when you Restart Linux

Use the following script to specify the user you want to start MVISION Cloud Connector with when you restart the Linux system. MVISION Cloud Connector is installed after the restart. 

  1. Begin with MVISION Cloud Connector starting in the following folder:
/home/swathi/shnlp/
  1. Create a shell script pointing to the shnlps service of this Cloud Connector as follows:
[swathi@aws-ec05 ~]$ cat /home/swathi/swathiec.sh
#!/bin/sh
/home/swathi/shnlp/shnlps start
  1. Give executable permission to this shell script file:
[root@aws-ec05 swathi]# chmod +x swathiec.sh
  1. Now add a service unit in the folder: cd /etc/systemd/system. Create a file called connection.service and add the following config:
[root@aws-ec05 system]# cat connection.service
[Unit]
Description = Starting MCC

[Service]
Type=forking
User=swathi
ExecStart = /home/swathi/swathiec.sh

[Install]
WantedBy = multi-user.target

In the above file, User is the userID that the Cloud Connector shnlps service uses to auto-start after the VM restarts.

  1. To reload the systemd process, execute following command:
sudo systemctl deamon-reload
  1. Start the service using the following commands to check on the auto-start status:
[root@aws-ec05 swathi]# sudo systemctl start connection.service

[root@aws-ec05 swathi]# ps -aef | grep shnlp
swathi 30090 1 99 13:31 ? 00:00:11 /home/swathi/shnlp/jre/bin/java -Dinstall4j.jvmDir=/home/swathi/shnlp/jre -Dexe4j.moduleName=/home/swathi/shnlp/shnlps -Dinstall4j.launcherId=24 -Dinstall4j.swt=false -Di4jv=0 -Di4jv=0 -Di4jv=0 -Di4jv=0 -Di4jv=0 -Xmx11914m -XX:+HeapDumpOnOutOfMemoryError -XX:-CreateMinidumpOnCrash -Duser.country=US -Duser.language=en -Djsse.enableSNIExtension=false -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true -Dcom.shn.ec.config.sync.enabled=true -Di4j.vpt=true -classpath /home/swathi/shnlp/.install4j/i4jruntime.jar:/home/swathi/shnlp/.:/home/swathi/shnlp/3rdparty/scala-library-2.10.0-M1.jar:/home/swathi/shnlp/3rdparty/shn-gsb-scala-2.9.1.1.jar:/home/swathi/shnlp/original-logprocessor.jar com.install4j.runtime.launcher.UnixLauncher start e9310944 /home/swathi/shnlp/error.log /home/swathi/shnlp/output.log com.shn.logs.controller.LogReaderDisruptor
root 30136 29609 0 13:31 pts/0 00:00:00 grep --color=auto shnlp

[root@aws-ec05 swathi]# sudo systemctl status connection.service
● connection.service - Starting MCC
Loaded: loaded (/etc/systemd/system/connection.service; enabled; vendor preset: disabled)
Active: active (running) since Fri 2020-04-03 13:31:47 UTC; 19s ago
Process: 29999 ExecStart=/home/swathi/swathiec.sh (code=exited, status=0/SUCCESS)
Main PID: 30090 (java)
CGroup: /system.slice/connection.service
└─30090 /home/swathi/shnlp/jre/bin/java -Dinstall4j.jvmDir=/home/swathi/shnlp/jre -Dexe4j.moduleName=/home/swathi/shnlp/shnlps -Dinstall4j.launcherId=24 -Dinstall4j.swt=false -Di4jv=0 -Di4jv...

Apr 03 13:31:47 aws-ec05.qa.corp.shn systemd[1]: Starting Starting MCC...
Apr 03 13:31:47 aws-ec05.qa.corp.shn swathiec.sh[29999]: Starting shnlps
Apr 03 13:31:47 aws-ec05.qa.corp.shn systemd[1]: Started Starting MCC.

NOTE: To make Cloud Connector run with the root user, simply comment out the line 'User=swathi' under [Service] in connection.service file.

  • Was this article helpful?