atom-worker.service automatic reload if down

171 views
Skip to first unread message

Uwe Jung

unread,
Mar 9, 2018, 10:00:43 AM3/9/18
to AtoM Users
Hello,

I'm working with AtoM 2.4. and Ubuntu Server 16.04 and became aware that sometimes the atom-worker service will shut down. I still ignore the reasons, but it could have something to do with large export job or so.
However I prefer to reload the service automatically if down.
As I read this should be possible by adding two line to /etc/systemd/system/multi-user.target.wants/atom-worker.service. (marked in red). But doing this I needed to replace the line "Restart=no" .
My question is, if this change could have any negative impact on Gearman, AtoM or the entire OS.

Thanks

Uwe Jung



Content: /etc/systemd/system/multi-user.target.wants/atom-worker.service
-------------------------------------------------------------
[Unit]
Description=AtoM worker
After=network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/usr/share/nginx/atom
ExecStart=/usr/bin/php -d memory_limit=-1 -d error_reporting="E_ALL" symfony jobs:worker
ExecStop=/bin/kill -s TERM $MAINPID
Restart=always
RestartSec=5

--------------------------------------------------------------

Dan Gillean

unread,
Mar 9, 2018, 11:41:31 AM3/9/18
to ICA-AtoM Users
Hi Uwe, 

Interesting idea! I don't think we at Artefactual have ever tried anything like this ourselves, but it does sound like it could work. I would suggest that you also look into some of the other directives available in systemd - particularly ones like StartLimitIntervalSec and StartLimitBurst. If your script runs, but for some unforeseen reason the atom-worker fails to start, then systemd could get trapped in an infinite loop of try, die, try, die, etc. Exploring some of these directives should provide a workaround for this sort of edge case. See: 
I would be very curious to know how this goes - please let us know once you've been using it for a while! 

Cheers, 

Dan Gillean, MAS, MLIS
AtoM Program Manager
Artefactual Systems, Inc.
604-527-2056
@accesstomemory

--
You received this message because you are subscribed to the Google Groups "AtoM Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ica-atom-users+unsubscribe@googlegroups.com.
To post to this group, send email to ica-atom-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/ica-atom-users/61d76cee-1798-4500-a4bf-cf2672df448c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Uwe Jung

unread,
Mar 9, 2018, 1:42:14 PM3/9/18
to ica-ato...@googlegroups.com
HI Dan,

Thanks for the link. Unfortunately I could not find any typical values for these parameters. So I prefer to test with the values 60 and 12. This seems reasonable to me for the moment.

Greetings

Uwe Jung


[Unit]
Description=AtoM worker
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=12  

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/usr/share/nginx/atom
ExecStart=/usr/bin/php -d memory_limit=-1 -d error_reporting="E_ALL" symfony jobs:worker
ExecStop=/bin/kill -s TERM $MAINPID
Restart=always
RestartSec=5
 

To post to this group, send email to ica-ato...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "AtoM Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ica-atom-users/X-07V3RUusw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ica-atom-users+unsubscribe@googlegroups.com.

To post to this group, send email to ica-atom-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.

Jonathan Chu

unread,
Jul 11, 2018, 1:06:07 PM7/11/18
to AtoM Users
Hello Uwe, 

I'm currently facing the same problem as you did - my atom-worker shuts itself down automatically at some point. I would like to reload it automatically, but couldn't follow how you did that. Would you mind guide me through the steps that make this work?

Many thanks

Jonathan

Uwe Jung

unread,
Jul 13, 2018, 2:58:13 AM7/13/18
to ica-ato...@googlegroups.com
Hello Johnathan,

thanks for the message.
The problem seems to be resolved with the modification I made inside the file /etc/systemd/system/multi-user.target.wants/atom-worker.service
Currently this file looks like this (I presume that you are running a Linux system  as well as a ordinary AtoM installation.):

[Unit]
Description=AtoM worker
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=12

[Install]
WantedBy=multi-user.target

[Service]
Type=simple
User=www-data
Group=www-data
WorkingDirectory=/usr/share/nginx/atom
ExecStart=/usr/bin/php -d memory_limit=-1 -d error_reporting="E_ALL" symfony jobs:worker
ExecStop=/bin/kill -s TERM $MAINPID
Restart=always
RestartSec=5


After modification the service needs to be restarted using sudo systemctl restart atom-worker


Using sudo systemctl status atom-worker you will get a status report.

Hope this could help you.

Greetings


Uwe Jung

--
You received this message because you are subscribed to a topic in the Google Groups "AtoM Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ica-atom-users/X-07V3RUusw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ica-atom-users+unsubscribe@googlegroups.com.
To post to this group, send email to ica-atom-users@googlegroups.com.
Visit this group at https://groups.google.com/group/ica-atom-users.
Reply all
Reply to author
Forward
0 new messages