Author Topic: tmux script relaunching  (Read 2450 times)

Offline phirestalker

  • Junior Indexer
  • **
  • Posts: 49
  • Helpful: +0/-0
tmux script relaunching
« on: 2016-05-12, 07:50:05 PM »
I have noticed that sometimes the tmux script just dies. I was wondering what the best way to relaunch automatically is.

I was thinking of removing the three attach() calls in run.php to make it able to be run without a console. I.E monit or some other service that would relaunch start.php.

Let me know your thoughts or what you have done that works

Thanks

Offline kilgore

  • Junior Indexer
  • **
  • Posts: 22
  • Helpful: +0/-0
Re: tmux script relaunching
« Reply #1 on: 2016-05-12, 08:07:36 PM »
There must be something causing this.. I go for weeks and never have it die..

You could make a script that ever 24 hours shuts it down, optimize database, and restart....


Offline phirestalker

  • Junior Indexer
  • **
  • Posts: 49
  • Helpful: +0/-0
Re: tmux script relaunching
« Reply #2 on: 2016-05-12, 08:11:59 PM »
ya I think it is my full system backup at 12AM that is causing it. I was going to make it shut down the tmux before the backup. Also it would be nice to have the script start when the system does. So 2 questions.

1. What is the nicest way to shut down the script. I have been using `tmux kill-session`
2. What method might I use to start the script on boot. I have Ubuntu 16.04, init scripts, anacron?

Thanks

Offline kilgore

  • Junior Indexer
  • **
  • Posts: 22
  • Helpful: +0/-0
Re: tmux script relaunching
« Reply #3 on: 2016-05-13, 08:08:58 AM »
I just use the stop.php  in the tmux directory.. takes 5 minutes, but it seems to actually shut down all my scripts in less than a minute..  Then i do a tmux kill-session -t nZEDb  .. nZEDb is what my tmux session is named.. I can't remember if that is default or not.

I use the start.php to start my tmux... you can make an init script.. there are plenty of examples on the internet for Ubuntu.. You just need to make sure it starts up after apache, mysql, etc start up..   You can set a priority for all your init scripts..

How are you doing your system backup?  rsync?


Offline phirestalker

  • Junior Indexer
  • **
  • Posts: 49
  • Helpful: +0/-0
Re: tmux script relaunching
« Reply #4 on: 2016-05-13, 10:20:39 AM »
lol, I guess it pays to look in the directory.... stop.php what an idiot I am.

You said that you run tmux kill-session after that? So does stop.php just do what checking false in the web interface does and keeps new scripts from running?

I believe rear's default method is tar, so I guess it just points tar at / and lets it go.

Offline kilgore

  • Junior Indexer
  • **
  • Posts: 22
  • Helpful: +0/-0
Re: tmux script relaunching
« Reply #5 on: 2016-05-13, 08:41:23 PM »
stop.php just stops all the scripts from running.. The Tmux session still exists until you kill it..

I'm not familiar with rear..  tar is just a compression program like zip.. 

I normally do backups of directories to an external drive or server.  Rsync is a great method to do this because after the first time you run it, it only updates newly updated and added files..   So it's very efficient.  I am pretty sure you can combine it with tar.  It also doesn't act as a resource hog and I have it running while everything else is working without a problem.

If you are backing up your mySQL database..  you can script that before or after you optimize it every 24 hours..


Offline phirestalker

  • Junior Indexer
  • **
  • Posts: 49
  • Helpful: +0/-0
Re: tmux script relaunching
« Reply #6 on: 2016-05-13, 09:25:58 PM »
I think it is called REstore And Relax. I don't really know how it does it internally. I think it is only backing up files. I would have just used rsync but I needed a solution that is easy to restore bare metal. REAR provides this by integrating with the GRUB bootloader and mastering an iso to boot from each time it backs up. It is set and forget, but thanks for the tips. I will probably stop the scripts kill tmux, optimize and backup

ok found misc/update/optimise_db.php so will run that to optimize tables
« Last Edit: 2016-05-13, 10:07:20 PM by phirestalker »