Linux nohup crashing MySQL Server
Discussion
Okay, long story short a few months back I asked how we could run our server without it hanging up when I left git bash and someone told me to use this:
nohup python app.py > /dev/null 2>&1 &
But now to run the MySQL Server in the background for workbench, I added this 'runserver ' statement.
nohup python app.py > /dev/null 2>&1 runserver &
This causes the server to not handle database related tasks after a period of inactivity.
Is there a way we can fix this issue or operate both tasks?
Any help is appreciated
nohup python app.py > /dev/null 2>&1 &
But now to run the MySQL Server in the background for workbench, I added this 'runserver ' statement.
nohup python app.py > /dev/null 2>&1 runserver &
This causes the server to not handle database related tasks after a period of inactivity.
Is there a way we can fix this issue or operate both tasks?
Any help is appreciated
Edited by CasioPasio on Wednesday 3rd October 13:19
4x4Tyke said:
I was thinking the same thing because previously didn't have this and it worked fine. CasioPasio said:
Okay, long story short a few months back I asked how we could run our server without it hanging up when I left git bash and someone told me to use this:
nohup python app.py > /dev/null 2>&1 &
But now to run the MySQL Server in the background for workbench, I added this 'runserver ' statement.
nohup python app.py > /dev/null 2>&1 runserver &
This causes the server to not handle database related tasks after a period of inactivity.
Is there a way we can fix this issue or operate both tasks?
Any help is appreciated
There's something I don't understand, what is runserver? Don't you normally just go mysqld --daemonize or use the supplied init files?nohup python app.py > /dev/null 2>&1 &
But now to run the MySQL Server in the background for workbench, I added this 'runserver ' statement.
nohup python app.py > /dev/null 2>&1 runserver &
This causes the server to not handle database related tasks after a period of inactivity.
Is there a way we can fix this issue or operate both tasks?
Any help is appreciated
Edited by CasioPasio on Wednesday 3rd October 13:19
buggalugs said:
There's something I don't understand, what is runserver? Don't you normally just go mysqld --daemonize or use the supplied init files?
I'm assuming that is his startup script, and its running it in the local context and dropping to the defaults.@op, have you tried piping the output to a text file to see if you get some meaningful feedback?
At best this should be setup in systemd or init, at worst you could use supervisord instead. Running things in unmonitored disowned shell jobs is just asking for a pita.
Maybe try this:
nohup sh -c 'runserver && python app.py' > /dev/null &
but please consider not doing it this way. plllllzzzz
Looking at the above though has app.py changed? it looks like it's expecting an argument. You might need to share the content of 'runserver'.
Maybe try this:
nohup sh -c 'runserver && python app.py' > /dev/null &
but please consider not doing it this way. plllllzzzz
Looking at the above though has app.py changed? it looks like it's expecting an argument. You might need to share the content of 'runserver'.
Edited by GrumpyTwig on Wednesday 3rd October 15:58
As above, use systemd for this, it's the correct way to do it.
https://dev.mysql.com/doc/refman/8.0/en/using-syst...
https://dev.mysql.com/doc/refman/8.0/en/using-syst...
GrumpyTwig said:
At best this should be setup in systemd or init, at worst you could use supervisord instead. Running things in unmonitored disowned shell jobs is just asking for a pita.
Maybe try this:
nohup sh -c 'runserver && python app.py' > /dev/null &
but please consider not doing it this way. plllllzzzz
Looking at the above though has app.py changed? it looks like it's expecting an argument. You might need to share the content of 'runserver'.
Hey thanks for the input. I tried that but I get this:Maybe try this:
nohup sh -c 'runserver && python app.py' > /dev/null &
but please consider not doing it this way. plllllzzzz
Looking at the above though has app.py changed? it looks like it's expecting an argument. You might need to share the content of 'runserver'.
Edited by GrumpyTwig on Wednesday 3rd October 15:58
How would you suggest we get this server setup for the long run? I've looked around but most tutorials seem to be for 'testing' purposes and not for a real production enviroment
CasioPasio said:
GrumpyTwig said:
At best this should be setup in systemd or init, at worst you could use supervisord instead. Running things in unmonitored disowned shell jobs is just asking for a pita.
Maybe try this:
nohup sh -c 'runserver && python app.py' > /dev/null &
but please consider not doing it this way. plllllzzzz
Looking at the above though has app.py changed? it looks like it's expecting an argument. You might need to share the content of 'runserver'.
Hey thanks for the input. I tried that but I get this:Maybe try this:
nohup sh -c 'runserver && python app.py' > /dev/null &
but please consider not doing it this way. plllllzzzz
Looking at the above though has app.py changed? it looks like it's expecting an argument. You might need to share the content of 'runserver'.
Edited by GrumpyTwig on Wednesday 3rd October 15:58
How would you suggest we get this server setup for the long run? I've looked around but most tutorials seem to be for 'testing' purposes and not for a real production enviroment
nohup sh -c 'runserver && python app.py' > /dev/null 2>&1 &
But as above, it needs setting up with systemd/init. Please don't take offence but maybe you need to engage the services of someone with the know how to do this.
If you can tell us what distro and version you're one it might be possible to point you in the direction of a workable tutorial.
Edited by GrumpyTwig on Wednesday 3rd October 19:52
TooLateForAName said:
does this work?
nohup python app.py runserver > /dev/null 2>&1 &
but as above - do it properly. If this is commercial get someone in for a day to check over what the server is intended to do and make it use proper admin tools.
Tried it, that doesn't work either. It tells me to use 'runserver' as above.nohup python app.py runserver > /dev/null 2>&1 &
but as above - do it properly. If this is commercial get someone in for a day to check over what the server is intended to do and make it use proper admin tools.
rxtx said:
MySQL should come with init scripts, how did you install it?
Never use nohup, it's never the correct choice for anything live. If your Python script runs as a daemon, it too will need an init script. It might be systemd, might not.
sudo apt-get install mysql-serverNever use nohup, it's never the correct choice for anything live. If your Python script runs as a daemon, it too will need an init script. It might be systemd, might not.
We need a temporary solution until we can get someone in.
GrumpyTwig said:
nohup sh -c 'runserver && python app.py' > /dev/null 2>&1 &
But as above, it needs setting up with systemd/init. Please don't take offence but maybe you need to engage the services of someone with the know how to do this.
If you can tell us what distro and version you're one it might be possible to point you in the direction of a workable tutorial.
Edited by GrumpyTwig on Wednesday 3rd October 19:52
I've had to learn this in a couple of days, it's not my playing field.I spoke to someone and they said somewhere between £500 to a £1000 for a 1 day and it would be done. At this early stage in the company, we don't want to make a that sort of investment yet.
So I think maybe just having it not cut out for now would be a good start until we progress further.
A grand to get MySQL to work, Jesus I feel like I’ve wasted my life
A lot of providers will do MySQL as a service, rackspace AWS Azure Linode basically all of them, might that be a way forward?
If you can do a python app you should be able to get a set of systemd scripts running - #devops
A lot of providers will do MySQL as a service, rackspace AWS Azure Linode basically all of them, might that be a way forward?
If you can do a python app you should be able to get a set of systemd scripts running - #devops

Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


