jsmsj / sa-drive

An alternative of Shared drive/teamdrives. Utilises the 15gb storage of each service account. The more service accounts you have, the more storage you will get. With 100 service accounts you can get about 1.46TiB of storage.
GNU General Public License v3.0
67 stars 9 forks source link

restarting the main.py #7

Closed dsakura closed 2 months ago

dsakura commented 2 months ago

I installed it with virtualenv, everything is fine. But if I restart the computer, will I need to run it again or will it start automatically? If not, how can I automate it every time I start the computer? And what command in cmd do I need to run to start the application again?

Many thanks!

dsakura commented 2 months ago

Nevermind, I think little more and solve it. So as not to waste the issue I opened, I will show what I did to anyone else who is interested.

  1. Create and save a batch file:
@echo off

call <PC virtual env address>\Scripts\activate.bat
call python <PC sa-drive address>\main.py
  1. Create service using program NSSM. Run the code: nssm install <name for the service> "<batch file address/batchfile.bat>

  2. Create log files. Create folder where you want to place de logs file. Run the code: nssm edit <service name>

On the nssm window, go to the I/O tab, and fill in the output and error fields adding the address and name for the log files. like: C:\sa-drive-logs\output.log

Click on Edit Service, and then run the command: nssm start <service name>

Thats it! Many thanks!