0

To create a python script to update the ubuntu server

so what i want is a script to automate the updated on my ubuntu server as well as mac mini's. but only in the night time cause that will save the day time traffic and developers can work without slow internet problem. please any help would be grate full

2nd Jun 2018, 7:23 AM
Robert Rajendra
Robert Rajendra - avatar
3 Respostas
+ 1
wont give you a ready code since dont know what kind of updates you need, here is something yo give you a general idea. import os import time while True: if time.ctime < xxxxxx and time.ctime > xxxxxx: os.system(update) else: time.sleep(5) you need to do some slicing and dicing for the times to make sure its night time :)
2nd Jun 2018, 11:42 AM
Markus Kaleton
Markus Kaleton - avatar
0
yeh this looks great , but i think i need updated like,,,,, package updated for ubuntu generally like the updates that we get from this command #sudo apt-get updates so how do i put this in a .sh file since sudo will be asking for password again and again and i need the script in the client pc cause client users they dont know sudo password
2nd Jun 2018, 1:52 PM
Robert Rajendra
Robert Rajendra - avatar
0
os.system() arg can be any shell command. You could consider running the script with sudo and test out if it asks it. Can't really help with updating macs since havent worked on/with apple products before.
2nd Jun 2018, 8:24 PM
Markus Kaleton
Markus Kaleton - avatar