Automic Workload Automation

Expand all | Collapse all

Start Linux Service Manager automatically after reboot?

Bademo06-05-2017 12:28 PM

  • 1.  Start Linux Service Manager automatically after reboot?

    Posted 05-30-2017 04:18 PM
    Using Service Manager in Linux is relatively new for me, so I hope the answer is a simple one.
    I've noticed that after our Linux boxes reboot, I have to log in and manually start the Service Manager so that we can get the agent running. Am I missing something? In windows, Service Manager starts automatically at boot. How do I enable this in Linux?
    AE11


  • 2.  Start Linux Service Manager automatically after reboot?

    Posted 05-31-2017 02:53 AM
    Thats a classical Linux Admin Question :-)

    in WIN it starts automatically because you register the SMGR binary as service.

    in LINUX you have to do the same - unfortunately Automic missed to add a section to documentation here.

    https://docs.automic.com/documentation/WEBHELP/English/AWA/11.2/AE/11.2/All%20Guides/help.htm#ucabjj.htm%3FTocPath%3DAdministration%2520Guide%7CInstallation%7CNew%2520Installation%7CInstallation%2520Procedure%7CInstalling%2520the%2520ServiceManager%7C_____1

    Here is a hint:
    http://www.linuxquestions.org/questions/linux-general-1/how-do-i-automatically-start-a-program-at-start-up-102154/

    may be different to your LINUX distribution...


    BTW: you could open a support ticket or make a suggestion on ideas.automic.com to add this chapter to documentation.




  • 3.  Start Linux Service Manager automatically after reboot?

    Posted 06-01-2017 12:14 PM
    We created a script called "ucybsmgr_start.sh" with the command line to start the Service Manager and added it to run on boot.


  • 4.  Start Linux Service Manager automatically after reboot?

    Posted 06-05-2017 12:28 PM
    Thanks to both of you! Very helpful!


  • 5.  Start Linux Service Manager automatically after reboot?

    Posted 08-01-2017 12:05 PM
    We created a script called "ucybsmgr_start.sh" with the command line to start the Service Manager and added it to run on boot.
    I used the same approach except that I used the command straight in the crontab entry with @reboot 
    example:
    @reboot  cd <location of ervice manager bin directory>; nohup ./ucybsmgr <system name> &

    Hope this helps.


  • 6.  Start Linux Service Manager automatically after reboot?

    Posted 09-15-2017 09:20 AM
    Hi Lucas_Amorim_9853  and FrankMuffke

    Ok, if I added in crontab the script for start service Manager, but my question is if the service ServiceManager is ok with status started, when the check is do, and only one agent stopped, the agent will be started, or check only if ServiceManager is ok, and started?

    Thanks
    Karina



  • 7.  Start Linux Service Manager automatically after reboot?



  • 8.  Start Linux Service Manager automatically after reboot?

    Posted 09-15-2017 09:50 AM
    Hi FrankMuffke ,

    Thank your answer.

    Is that the service about ServiceManager will be checked every 5 minutes, in Crontab,  for examinate if the service is started.
    The question is if I added in CronTab for check if the ServiceManager is ok, the agents too will be checkeds and started, when one agent was stopped, but the ServiceManager is with status started?

    Thanks
    Karina




  • 9.  Start Linux Service Manager automatically after reboot?

    Posted 09-15-2017 11:15 AM

    Hi Lucas_Amorim_9853, you said that you created  one script called "ucybsmgr_start.sh" with the command line to start the Service Manager and added it to run on boot.

    My question is:

    If I uses the script for checks if the ServiceManager was started, and the serviceManager is ok, but only one agent is stopped, this agent will be start, or only when the service ServiceManager is stopped?





  • 10.  Start Linux Service Manager automatically after reboot?

    Posted 09-15-2017 01:43 PM
    Now I understand.

    No, the service Manager is "just a service" that makes you able to start or stop AE, Agents, Tomcat, ... via Automation engine (script) or commandline or SMGR Dialog.




  • 11.  Start Linux Service Manager automatically after reboot?

    Posted 09-15-2017 04:42 PM
    I believe as part of Linux ServiceManager package Automic already provides some sample script for "Automic ServiceManager daemon". I am not certain if this is reflected anywhere in their documentation with any recommendations on customization and installation.

    Example script content below retrieved from package for ARA 11.2.3 that was downloaded back in November 2016.
    ...\Automic.Release.Automation_11.2.3_2016-11-01\Automation.Platform\ServiceManager\unix\linux\x64\ucsmgrlx6.tar\ucsmgrlx6\bin\automicsm
    ...
    #!/bin/sh ### BEGIN INIT INFO # Provides:          ucybsmgr # Required-Start:    $network $remote_fs $syslog # Required-Stop:     $network $remote_fs $syslog # Default-Start:     3 5 # Default-Stop:      0 1 6 # Short-Description: Automic ServiceManager daemon # Description:       Start or stops the Automic ServiceManager daemon ### END INIT INFO DAEMON_PATH="/opt/Automic/Automation.Platform/ServiceManager/bin" DAEMON=./ucybsmgr DAEMONOPTS="-iucybsmgr.ini Automic" NAME=automicsm DESC="Automic Service Manager" PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME ORAHOME_INST="" AUTOMIC_HOME="/opt/Automic" case "$1" in start)      printf "%-50s" "Starting $NAME..."      cd $DAEMON_PATH            if [ ! -d "$ORACLE_HOME" ]; then           ORACLE_HOME=$ORAHOME_INST      fi      LD_LIBRARY_PATH=".:$ORACLE_HOME/lib"      JAVA_HOME="${AUTOMIC_HOME}/External.Resources/JDK"      PATH="${JAVA_HOME}/bin:${PATH}"      export ORACLE_HOME      export LD_LIBRARY_PATH      export JAVA_HOME      export PATH      PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`      #echo "Saving PID" $PID " to " $PIDFILE      if [ -z $PID ]; then           printf "%s\n" "Fail"      else           echo $PID > $PIDFILE           printf "%s\n" "Ok"      fi ;; status)      printf "%-50s" "Checking $NAME..."      if [ -f $PIDFILE ]; then           PID=`cat $PIDFILE`           if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then                printf "%s\n" "Process dead but pidfile exists"           else                echo "Running"           fi      else           printf "%s\n" "Service not running"      fi ;; stop)      printf "%-50s" "Stopping $NAME"      PID=`cat $PIDFILE`      cd $DAEMON_PATH      if [ -f $PIDFILE ]; then           kill -TERM $PID           printf "%s\n" "Ok"           rm -f $PIDFILE      else           printf "%s\n" "pidfile not found"      fi ;; restart)      $0 stop      $0 start ;; *)      echo "Usage: $0 {status|start|stop|restart}"      exit 1 esac
    ^^^--- We don't use this exact script but have something very similar custom developed, configured and installed by company Linux administrators.



  • 12.  Start Linux Service Manager automatically after reboot?

    Posted 09-18-2017 04:50 AM
    The Service Manager is a daemon, that's roughly what Windows folks call a Service.

    Technically, cron is NOT the place to start daemons. The place to start daemons is the system's start mechanism, which is the System V init (/etc/init.d) with older Linux, "upstart" for a brief period on Debian/Ubuntu, or systemd on most current Linux variants. Of course you can do it from cron, but it's sort of wrong, and has some drawbacks:

    1. other UNIX admins won't neccessarily look in your crontab - not a problem if you alone are maintaining it, but with multiple people it pays to stick to standards
    2. you can not use the established ways of starting and stopping it manually (but someone has to know where your custom shell script is) - same as above
    3. graphical, web based (such as webmin, god forbid someone use that) or text-based system configuration tools (such as the venerable "chkconfig" and friends) can't be used to configure your daemon (which, again, may confuse other people who might maintain your system).
    4. you lose useful logging, especially with systemd
    5. your systemd commands on a modern system will be blind to the status of your daemon, and all other commands that depend on it will be, too. E.g. if you manage multiple systems with Puppet, that becomes a liability fast
    6. you lose the (direct) ability do make dependencies (especially with upstart and systemd), e.g. "start Automic only after the network has started"
    7. stuff possibly doesn't get stopped properly when you shut the server down (or switch "run level").

    Therefore, it's recommended that you find out what startup system your distribution uses.

    System V:

    you can use a script like the one Vlad_Navazhylau_6186 gave in /etc/init.d. There is a multitide of tutorials if one googles "system v init tutorial" or such, but in short: Put your script in /etc/init.d, make sure it starts your Service Manager when called with the parameter "start" and ends it when called with "stop". Find out your systems run-level by typing "runlevel" (it's the rightmost number in the output, usually "3" for text based servers), then symlink it to the respective directory (/etc/init.d/rc.3.d for runlevel 3). The system will run each script with the parameter "start" that it finds in that directory when it enters the respective runlevel (i.e. when it boots), and with "stop" when it leaves that run level (e.g. shuts down).

    If you want to avoid doing that work, most distributions have an /etc/init.d/rc.local as a collective script for all server-local things, you can put your Service Manager start commands (or script reference) in there, too.

    Bonus: You can also tell Linux to ensure your service manager is always running, by entering it with the  /etc/inittab with the "respawn" keyword. This is better than doing it in cron, because a) you don't need to wait for it respawning until the next run of your cronjob, and b) it works even if cron has crashed (yes, I've seen it happen multiple times). But I do NOT recommend using this mechanism, because sometimes you WANT to [edit] stop Automic, and I can forsee some other issues with that. So I recommend you use a start script as described above.

    Upstart:

    Sorry, you are on your own, but upstart is mostly dead imho, and most distributions replace it by systemd anyways

    Systemd:

    I already posted an example systemd unit file here, use systemctl and friends to manage your systemd start up afterwards.
    https://community.automic.com/discussion/comment/30533#Comment_30533

    Best,
    Carsten


  • 13.  Start Linux Service Manager automatically after reboot?

    Posted 09-18-2017 05:05 AM
    Just a installation hint for Service Manager (Unix and Windows)

    As its not possible to get config changes working without a SMGR restart it might make sense splitting up Automation Engine SMGR Services and Agent SMGR services.

    Doing this you are able starting and stopping just a bunch of services - sticking to my example just Automation Engine or all agents running on that machine.


  • 14.  Start Linux Service Manager automatically after reboot?

    Posted 09-19-2017 06:02 AM
    FIY: to check agent status,you have few options:

    1/ System overview or Administration perspective
    2/ Service manager dialog
    3/ Linux server itself by running this comand
    ps -ef|grep uc
    You will find a bunch of processes like Service manager or your linux agent...


  • 15.  Start Linux Service Manager automatically after reboot?

    Posted 09-19-2017 09:27 AM
    Hi FrankMuffke and Dat_Nguyen-Tat_9196

    Thank you for the informations!

    Best regards,
    Karina