ArcGIS Server does not start at boot - Linux - CentOS 7

6505
7
Jump to solution
06-11-2015 07:30 AM
MarkLittell
New Contributor III

How do I get the server 'service' to start during the boot process on CentOS 7?

Currently, I have to login to the server and launch the startserver.sh script manually after a reboot.

Is there a systemctl command I can run?

Please advise & thanks

- Mark

1 Solution

Accepted Solutions
DanielUrbach
Occasional Contributor II

It may also be worth noting that if you are using CentOS 7.1, that 'arcgisserver' script provided will not work, as the ifconfig command is deprecated.

One fix for this that I found was to open the 'arcgisserver' script file and change this line:

myip='ifconfig | grep "Bcast:" | grep -v 127.0.0.1'

to this:

myip='ip addr | grep "inet" | grep -v 127.0.0.1'

View solution in original post

7 Replies
VinceAngelo
Esri Esteemed Contributor

The documentation covers how to configure a boot script on supported platforms, though it's not clear from your question that CentOS 7 qualifies (RHEL 7 support only begins at 10.3.1​ and CentOS is only supported in builds identical to RHEL).

     ArcGIS Server 10.1 (Step 7)

     ArcGIS Server 10.2 (Step 7)

     ArcGIS Server 10.3 (Step 7)

- V

DanielUrbach
Occasional Contributor II

It may also be worth noting that if you are using CentOS 7.1, that 'arcgisserver' script provided will not work, as the ifconfig command is deprecated.

One fix for this that I found was to open the 'arcgisserver' script file and change this line:

myip='ifconfig | grep "Bcast:" | grep -v 127.0.0.1'

to this:

myip='ip addr | grep "inet" | grep -v 127.0.0.1'

MarkLittell
New Contributor III

I believe my problem is solved - thanks for the
assistance.

Vince, it is AGS 10.3.1 on CentOS 7.1.1503 (Core) and starts and runs fine by manually running the startserver.sh script. I looked high and low (Google) on how to do this. I guess I didn't use the right words - I used boot & startup - but what you posted was exactly what I was looking for.

But, it didn't fix the problem, directly.

Daniel, not sure if your pointer was the solution or led me down the path - either way, thank you very much.

Here is what I did - I'll try to describe it:

I followed the Step 7 process from Vince. The service would still not start during boot.

I started troubleshooting it...

I tried to execute the script as root, it would 'process' and after 20 seconds or so, drop back to the Terminal prompt. No errors, no success, nothing.

I then ran the startserver.sh script as root, and was told root was not allowed - I expected this.

Then Daniel replied.

Via Google, I saw where the CentOS 7 'minimal' no longer had ifconfig. I was running CentOS 7 'DVD' and confirmed ifconfig worked in Terminal.

I thought, I'd give the change a shot, I've seen stranger things happen.

I went into the arcgisserver script and changed the ifconfig line to ip addr per his post.

I then ran the arcgisserver script as root. This time, I received a response - I forget the exact - something about it calling the agsserver as root was ungood and would change the user to the ArcGIS Server Install user account (pretty cool).  But then it failed saying something about it was expecting an attribute (start | stop) with the launch command.

I explored the arcgisserver script again and saw where it was using a $1 attribute. It wasn’t being provided and I couldn’t easily see where it should be coming from.

So I ‘hacked’ it. I changed the $1 text to the word ‘start’.

Rebooted the server and the service is up and running!

I hope this helps someone.

Thanks for your time & assistance Vince & Daniel.

  • Mark
0 Kudos
DanielUrbach
Occasional Contributor II

Mark, I'm glad to hear you got it working, but it may not work as you expect it to later on down the road.

From what you reported about getting the 'Invoking user (root) is not ArcGIS Server owner...' warning, it sounds like you are executing

# service arcgisserver

rather than

# service arcgisserver start

If you change $1 to start in the script, then you will not be able to stop the server via that script, it will always try to start it!

I recommend changing those two entries back to $1, and make sure to include an argument after 'arcgisserver' so it knows which functionality you are trying to use (start, stop and status are valid arguments to include).

-Danny

VinceAngelo
Esri Esteemed Contributor

Furthermore, you can test service maintenance by using:

    # service servicename start

     # service servicename restart

     # service servicename stop

I wrote my own boot script, which needs to deal with site-specific issues and set some necessary environment variables.  It's also smart enough to determine if it's being executed by the ArcGIS Server user account or by root as part of a 'service' invocation, and only doing an 'su' as needed.

- V

0 Kudos
MarkLittell
New Contributor III

Daniel,

I understand and agree with what you are saying.

With my limited CentOS knowledge, this script is only called when the server boots - see Step 7 from Vince above.

Following the Step 7 process, there is no where to put in the word 'start', it's all "automated." The chkconfig command will not accept start or stop - see Step 7 e.

The script is copied from another folder and placed in the etc / rc.d / init.d folder, per Step 7 b.

Heck, I have no idea why I did Step 7 d 2 - added "# chkconfig 35 99 01". I thought a leading pound sign was commenting it out.

Thanks

- Mark

0 Kudos
VinceAngelo
Esri Esteemed Contributor

Mark --

You need to read up on how RHEL boot scripts work.

The leading octothorpe is a comment, but that string pattern has a specific purpose within the 'chkconfig --add' utility.  To invoke a service script which is installed by 'chkconfig' you utilize the 'service' command.  Therefore, you need to do the following before the service is ready to run at boot time:

# cp path_to_ArcGIS_template /etc/init.d/servicename

# chmod +x /etc/init.d/servicename

# vi /etc/init.d/servicename

# chkconfig --add

# service servicename stop

# service servicename start

# service servicename restart

# service servicename stop

- V