Hello again, @Alex Glaros and @Ben Duncan -- Thanks for your replies. I was trying to do a weekly backup in pythonanywhere . My script works finally (with many thanks to kind people out there like yourselves). I can choose a day of the week and put that in (weekday == int) 0 being Monday. I remove the old file first and then get a new file for the backup. My good script is below:-)
import datetime import os today = datetime.date.today() weekday = today.weekday() if (weekday == 0): os.system("rm -f pgbackup*") os.system("pg_dump --host=[hostname] --port=[port number] --username=[username] --format=c --file=pgbackup`date +%F-%H%M`.dump --dbname=[your_database_name]") Catch you later ! On Wed, Nov 7, 2018 at 12:34 AM Alexandra Lee <palexa...@gmail.com> wrote: > Hi. thanks for your reply. I need to take my question down. > > I got it. > > Kind regards, > Alexandra > > On Mon, Nov 5, 2018 at 2:25 AM Alex Glaros <alexgla...@gmail.com> wrote: > >> Alexandra, I have not used it recently and only have my notes below: >> >> pg_dump --host= >> yourPythonAnywhereDbName.postgres.pythonanywhere-services.com >> --dbname=postgres_myDbName --(note: I don't know how to handle password) >> --port=10097 --username=yourPythonAnywhereRole --format=c >> --file=pg_alex_backup`date +%F-%H%M`.dump >> >> -- >> Resources: >> - http://web2py.com >> - http://web2py.com/book (Documentation) >> - http://github.com/web2py/web2py (Source code) >> - https://code.google.com/p/web2py/issues/list (Report Issues) >> --- >> You received this message because you are subscribed to the Google Groups >> "web2py-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to web2py+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.