I Have a question about Python String formating.
This is my String:
csvFile__ProjectID = 83498246 rexelCSV = '%sr.csv' % (csvFile__ProjectID)
Is it possible to do like this:
csvFile__ProjectID = 83498246 rexelCSV = '%sr?.csv' % (csvFile__ProjectID)
?is for any Key
I hope you understand what I want 😂
Do you happen to know what permissions a user needs to work with Synology-api ?
if I put the user I created for my app in the admin group it works, otherwise not but would not like to share the admin for it.
I have adjusted the query.
So, are you trying to keep your NAS from sleeping while using the app?
Yes, that was exactly my thought.
Or just want to prevent an error when it does sleep, by extending the timeout? (You could set a two minute timeout if you want to avoid an error)
I never got any errors, it's just stupid when you don't do anything for a longer time or some things need a longer time and then it's in sleep mode.
Have you checked out Synology python API?
No i don‘t checked Synology-API, but now i did....
Unfortunately, this is not what I'm looking for, since every time I query it, the sleep mode is interrupted.
I'm not sure if you can check hybernation status, but this might kick start things (say, try to run a file station download).
I guess that's true...
I could now go here and after opening the app simply create a loop where every x minutes a query would be created so that the DS would not go into sleep mode for now or ?
Also, if I understand your issue is long timeout on MySQL connect -- _mysql.connect() let's you specify a connect_timeout value, which you could set to something short to see if server is responding.
This was a good idea, but unfortunately the DS is first brought out of sleep mode and this takes longer than my set time of 1 second so that it unfortunately does not work.
You can also execute ssh commands via paramiko -- I'm not sure if there is a shell command that let's you turn off hibernation. Frankly, on my DSM, it doesn't take that long to come out of hibernation, but I might be using things differently.
SSH I would have to look first again with my Key's etc....
And yes, as I said with me it takes up to 1 minute until he creates the query when the DS goes out.
I found this Script:
import sys import socket def servertest(argv): host = 'xx' port = 'Xxx' args = socket.getaddrinfo(host, port, socket.AF_INET, socket.SOCK_STREAM) for family, socktype, proto, canonname, sockaddr in args: s = socket.socket(family, socktype, proto) try: s.connect(sockaddr) except socket.error: return False else: s.close() return True if __name__ == "__main__": if servertest(sys.argv): print("Server is UP") else: print("Server is DOWN")
But since my NAS is never off but only in sleep mode I always get the message: Server is UP can I get around this ?