Re-check on startup every time.

Specific support for Deluge on Microsoft Windows OS
PaulBags
Member
Member
Posts: 12
Joined: Tue Jul 02, 2013 5:32 am
OS or Distro: Windows 10

Re-check on startup every time.

Postby PaulBags » Tue Jul 02, 2013 7:42 am

I'm at the end of my rope. How do I get windows to shutdown/logoff and gracefully let deluge (or any program) finish up and shutdown so that it doesn't need to re-check when it starts up again? Ideally I'd like to be able to use my physical power button to turn the computer off, but if I have to run a batch/shortcut from the desktop I will.

I'm creating batch files to pass commands to deluge-console.exe, (scripts below), but in trying to get windows to actually show the fricken shutdown script in the start menu: I logged off to try and get the item to load in the menu, and now I have to wait for deluge to recheck again. I had the same problem with utorrent, but I can't pass commands to that via console and I was getting sick of it anyway.

startup.bat

Code: Select all

start /D "C:\Program Files (x86)\Deluge\" deluged.exe /wait
start /D "C:\Program Files (x86)\Deluge\" deluge-console.exe resume * /wait
start /D "C:\Program Files (x86)\Deluge\" deluge.exe
exit


shutdown.bat

Code: Select all

start /D "C:\Program Files (x86)\Deluge\" deluge-console.exe pause * /wait
start /D "C:\Program Files (x86)\Deluge\" deluge-console.exe halt /wait
shutdown /s



(Also I tried to write out a post before, but between writing the post and mucking around with some stuff I got logged out and lost my post. Very frustrating.)




[edit]
pause *, halt, then logoff; and it still has to recheck when I log back in. Am I going to have to do this half an hour before I shutdown my computer?? Not impressed.

Cas
Top Bloke
Top Bloke
Posts: 3410
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Re-check on startup every time.

Postby Cas » Tue Jul 02, 2013 11:12 am

All you need to do is wait for deluged to close cleanly before shutdown, how long this takes depends on the number of torrents you have.

PaulBags
Member
Member
Posts: 12
Joined: Tue Jul 02, 2013 5:32 am
OS or Distro: Windows 10

Re: Re-check on startup every time.

Postby PaulBags » Tue Jul 02, 2013 8:31 pm

Hmm. I brought up cmd, task manager, and resoucre manager and watched what happens when I run deluge-console halt. Deluged quits pretty fast, but under disk activity I can see it takes awhile to write various files* in C:\Documents and Settings\<user>\AppData\Roaming\deluge, after deluged has already quit. That might be why start /D "C:\Program Files (x86)\Deluge\" deluge-console.exe halt /wait isn't working for me. Is there any way to force deluged to wait and check that files are properly written before quitting? I added a timeout to shutdown.bat, but that's not going to help much if the time is arbitrary. Only other thing I can think is to turn off caching on C:\, but I don't have the time this morning to wait for a recheck before I can check to see if that's helpful.

*It's an ssd, it shouldn't be taking that long to write the files; and since windows knows the files are writing it should wait for them to finish before shutting down anyway >_<.

Cas
Top Bloke
Top Bloke
Posts: 3410
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Re-check on startup every time.

Postby Cas » Tue Jul 02, 2013 9:00 pm

You don't need to use deluge-console at all in either script, it's pointless.

I am not sure why you don't simply have deluged shortcut in startup and extend the windows shutdown timeout if it's not closing cleanly. The logs (debug maybe) will show whether it's exiting properly.

Alternatively look into setting deluged up as a service.

PaulBags
Member
Member
Posts: 12
Joined: Tue Jul 02, 2013 5:32 am
OS or Distro: Windows 10

Re: Re-check on startup every time.

Postby PaulBags » Wed Jul 03, 2013 6:50 am

Cas wrote:You don't need to use deluge-console at all in either script, it's pointless.

I am not sure why you don't simply have deluged shortcut in startup and extend the windows shutdown timeout if it's not closing cleanly. The logs (debug maybe) will show whether it's exiting properly.

Alternatively look into setting deluged up as a service.

I got deluged set up as a service following the instructions here, and it seems to be behaving now. Thank you very much for your help :).

TheShanMan
Member
Member
Posts: 34
Joined: Sun Jun 23, 2013 4:16 pm
OS or Distro: Windows

Re: Re-check on startup every time.

Postby TheShanMan » Fri Mar 14, 2014 10:41 pm

Sorry to revive an old thread, but I *think* I'm having some shutdown problems with deluge running as a service. At least, it's the only thing I can think of to explain my problem. I've been seeing that a torrent site I'm on reports that many of my torrents status are at 0% even though they've long since downloaded fully and successfully, and deluge shows them as "seeding". In other words, deluge gives no indication of a problem, but one of the admins of the torrent site says that deluge is telling them my status is 0%.

If I do a force recheck on the torrents that show as 0%, the torrent site then sees them as complete/seeding. The only thing I can think of is that the service is not shutting down cleanly when I reboot. Is there anything I can do to fix this, and more importantly, if deluge is telling the site that my status is 0%, why won't it give me any indication of a problem?

robnitro
Member
Member
Posts: 19
Joined: Fri Sep 19, 2014 12:19 pm
OS or Distro: windows 7 x64

Re: Re-check on startup every time.

Postby robnitro » Fri Sep 19, 2014 11:01 pm

What exactly do we set for shutdown options? I have the service in nssm defaults, with logon as user, and if the service stops, due to shutdown or me manually stopping it, it shuts down and on resume, rechecks the torrent that was downloading, ARGH!

How the heck are we supposed to do a graceful shutdown in NSSM settings?
Default is Image
What exactly gives deluge the correct way to shut down? This wasn't mentioned in the thread.

Cas
Top Bloke
Top Bloke
Posts: 3410
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Re-check on startup every time.

Postby Cas » Sat Sep 20, 2014 9:11 am

On Windows the daemon will shutdown gracefully on CTRL_CLOSE_EVENT or CTRL_SHUTDOWN_EVENT and you might want to extend the timeouts. Use logging to determine is this is occuring.

robnitro
Member
Member
Posts: 19
Joined: Fri Sep 19, 2014 12:19 pm
OS or Distro: windows 7 x64

Re: Re-check on startup every time.

Postby robnitro » Sat Sep 20, 2014 12:45 pm

Thanks for the reply and info.
Sorry about that. I should have cross linked the issue.
What logging would I use? Event viewer doesn't seem to show much. Can I run deluged-debug.exe > logfile.log?

For now, I got a program called AlwaysUp, which makes the daemon a service. But it is not free.
For shutdown command in last tab, I now use deluge-console.exe halt... which works, despite not working for the original poster here.
I also set the timeout to wait up to 2 minutes.

In NSSM, under process, would we checkbox yes for console window?
I also tried with timeouts of 30,000 ms each (30 seconds). Still didn't do a graceful shutdown.

Cas
Top Bloke
Top Bloke
Posts: 3410
Joined: Mon Dec 07, 2009 6:04 am
OS or Distro: Ubuntu 16.04
Location: Scotland

Re: Re-check on startup every time.

Postby Cas » Sat Sep 20, 2014 1:55 pm

See FAQ about logging.

If using deluged-debug.exe, I expect you would need to check yes for console window, not sure when using deluged.exe. I don't use Windows so I am currently limited with what I can suggest but at some point I could try setting up NSSM in the VM I use for testing. In the meantime maybe you can post screenshots of the other tabs and I might be able to suggest something. There are other topics in the forum where users have got a service running properly on Windows so it must work.

If you do get it working it would probably be useful to create a wiki page creating a Windows service, alongside the Linux ones.


Return to “Windows OS”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest