Scheduler as a service RHEL 7

155 views
Skip to first unread message

Michael M

unread,
Mar 13, 2016, 1:20:36 AM3/13/16
to web2py-users
Currently I have "/etc/systemd/system/web2py-scheduler.service":
---------------------------------
[Unit]
Description=Web2py Scheduler service

chedulerService]
ExecStart=  /usr/bin/python /opt/www-data/web2py/web2py.py -K networktools -Q &
Restart=always
KillSignal=SIGQUIT
Type=notify
NotifyAccess=all

[Install]
WantedBy=multi-user.target
-----------------------


RHEL 7 and Im when i enable and start then get status i get "starting"  but never fully starts.  Am i calling it wrong or any thoughts?

Thanks!

Michael M

unread,
Mar 14, 2016, 2:27:30 AM3/14/16
to web2py-users
[root@server~]# systemctl status web2py-scheduler.service -l
● web2py-scheduler.service - Web2py Scheduler service
   Loaded: loaded (/etc/systemd/system/web2py-scheduler.service; enabled; vendor preset: disabled)
   Active: activating (start) since Sun 2016-03-13 19:09:14 PDT; 38s ago
 Main PID: 13549 (python)
   CGroup: /system.slice/web2py-scheduler.service
           └─13549 /usr/bin/python /opt/www-data/web2py/web2py.py -K networktools &

Mar 13 19:09:14 server systemd[1]: Starting Web2py Scheduler service.

Michael M

unread,
Mar 14, 2016, 2:32:47 AM3/14/16
to web2py-users
When I take off the '&' at the end of the command I get the following message:

# systemctl restart web2py-scheduler.service
Job for web2py-scheduler.service failed because a fatal signal was delivered to the control process. See "systemctl status web2py-scheduler.service" and "journalctl -xe" for details.

Michael M

unread,
Mar 15, 2016, 9:35:40 PM3/15/16
to web2py-users
I'm not stuck on getting it running as a Service. 

Just getting it so it runs when the server is power cycled or otherwise.  Insuring that the scheduler is running so it can do DB updates of flat-files that get dumped on the box daily.

Dave S

unread,
Mar 15, 2016, 10:36:30 PM3/15/16
to web2py-users
On Tuesday, March 15, 2016 at 2:35:40 PM UTC-7, Michael M wrote:
I'm not stuck on getting it running as a Service. 

Just getting it so it runs when the server is power cycled or otherwise.  Insuring that the scheduler is running so it can do DB updates of flat-files that get dumped on the box daily.

It's not clear whether that runs at an appropriate privilege level.  The upstart example in the deployment recipes has an explicit sudo in the invocation.  Do you need a sudo in your ExecStart?


/dps

Michael M

unread,
Mar 15, 2016, 11:43:23 PM3/15/16
to web2py-users
I read though that a ton of times but I believe RHEL 7 retired that method in /etc/init/ and conf files and moved to systemd and services. 

Ill try the sudo in ExecStart.  And report back.

Michael M

unread,
Mar 16, 2016, 1:49:44 AM3/16/16
to web...@googlegroups.com
So some googling later for "Persistant Python script Rhel7 service"
I changed the service to the following and now the service will run.

Thank-you Dave for getting me back to thinking about writing the service correctly.

Between the dashes below is this file: 

"/etc/systemd/system/web2py-scheduler.service"

And can be activated via:

"systemctl enable web2py-scheduler.service"
"systemctl start web2py-scheduler.service"

-------------
[Unit]
Description=Web2py Scheduler service

[Service]
ExecStart=/usr/bin/python /opt/www-data/web2py/web2py.py -K networktools,networktools,networktools
Type=simple

[Install]
WantedBy=multi-user.target
--------------

Dave S

unread,
Mar 16, 2016, 4:52:22 AM3/16/16
to web2py-users


On Tuesday, March 15, 2016 at 6:49:44 PM UTC-7, Michael M wrote:
So some googling later for "Persistant Python script Rhel7 service"
I changed the service to the following and now the service will run.

Thank-you Dave for getting me back to thinking about writing the service correctly.



 

Between the dashes below is this file: 

"/etc/systemd/system/web2py-scheduler.service"

And can be activated via:

"systemctl enable web2py-scheduler.service"
"systemctl start web2py-scheduler.service"

-------------
[Unit]
Description=Web2py Scheduler service

[Service]
ExecStart=/usr/bin/python /opt/www-data/web2py/web2py.py -K networktools,networktools,networktools
Type=simple

[Install]
WantedBy=multi-user.target
--------------


/dps

Michael M

unread,
Mar 17, 2016, 3:52:45 AM3/17/16
to web2py-users
Sorry Dave, I know how that goes :)

If you find a more elegant solution. I'm open.

Reply all
Reply to author
Forward
0 new messages